WooCommerce: Add product to cart with price override?

后端 未结 10 1567
轮回少年
轮回少年 2020-11-27 13:53
$replace_order = new WC_Cart();
$replace_order->empty_cart( true );
$replace_order->add_to_cart( \"256\", \"1\");

The above code add product

10条回答
  •  粉色の甜心
    2020-11-27 14:27

    You can use the following

    add_filter( 'woocommerce_cart_item_price', 'kd_custom_price_message' );
    
    function kd_custom_price_message( $price ) {
    
            $textafter = ' USD'; 
            return $price . $textafter;
    }
    

提交回复
热议问题