Home » , » Add custom price to product in woocommerce

Add custom price to product in woocommerce

Written By Unknown on Sabtu, 19 Oktober 2013 | 02.25

Woocommerce saves its product price in a dynamic database table in serialized form which are present on cart..... Hence we cannot edit it directly ...

So , to add your custom price use below code:

function add_custom_price( $cart_object) {

  $custom_price = 1151; // This will be your custome price 

  foreach ( $cart_object->cart_contents as $key => $value ) {
            $value['data']->price = $my_sess['price'];
        }
    } 
 add_action( 'woocommerce_before_calculate_totals', 'add_custom_price' )
;

 If you dont know where to add this code ... Add it at the top of wocommerce-functions.php file present in wocommerce plugin
 Yippe .. Now you got your custom price for the products :)
Share this article :

Posting Komentar

 
Support : Creating Website | Johny Template | Mas Template
Copyright © 2011. Kumpulan Kata Broadcast Blackberry - All Rights Reserved
Template Created by Creating Website Published by Mas Template
Proudly powered by Blogger