Notice: These forums are now retired and closed. For active support, please Submit a Ticket or visit our official WordPress.org community pages.
Kadence Theme | Kadence Blocks | Starter Templates | WooCommerce Email Designer | Ascend | Virtue | Pinnacle

update custom price woocommerce

Home / Forums / Virtue Theme / update custom price woocommerce

This topic is: Resolved
[Resolved]
Posted in: Virtue Theme
September 12, 2016 at 2:20 am

I have one doubt about Virtue premium and woocommerce, I try to update my custom price for some products but doesn’t work. I don’t know if is a problem from the theme, because with other themes works well.

my code is:
header(‘Location:

// define the woocommerce_review_order_after_submit callback
function action_woocommerce_review_order_after_submit( ) {

$custom_price = 10; // This will be your custome price
$target_product_id = 477;
foreach ( $cart_object->cart_contents as $value ) {
if ( $value[‘product_id’] == $target_product_id ) {
$value[‘data’]->price = $custom_price;
}
}
}
add_action( ‘woocommerce_before_calculate_totals’, ‘action_woocommerce_review_order_after_submit’ );

  • The forum ‘Virtue Theme’ is closed to new topics and replies.