In ProgressChange Price – Addon not submitting

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #25098
    dkuser
    Participant

    On our site, we have 2 different prices, which we change after user selection for delivery or pickup. For this we use a custom meta field and inject the new price with the filter woocommerce_product_get_price. If we change the price the addon is not calculated on top of the main price. The cart gets the news value but it doesnt calculate addons on top.

    Do you have a solution for this problem?

    —————-

    add_filter( 'woocommerce_product_get_price', 'custom_price', 10, 2 );
    function custom_price($price, $product) {
    	
    	$pid = $product->get_id();	
    	$custom_price = get_post_meta($pid, '_price_delivery', true);
    	
    	if(isset($_COOKIE['checkorderdelivery']) && $_COOKIE['checkorderdelivery'] == "pickup") :
    		$price = $custom_price;
    	endif;
    	
    	if(isset($_COOKIE['checkorderdelivery']) && $_COOKIE['checkorderdelivery'] == "delivery") :
    		$price = $price;
    	endif;
    	
        return $price;
    }

    —————-

    Thanks in advance

    #25105
    Althemist
    Keymaster

    Hello dkuser,

    I’ll ask our led developer and CTO Alex to spen and help if possible. However, please note that this is definitely not a good approach on the problem. Local pickup and delivery are a totally different functionality and they are not related to the product itself.

    Alex would tell if what you need is possible at all.

    Regards,
    Dimitar

    #25118
    dkuser
    Participant

    Hello Dimitar,

    thanks for the fast reply, i know its a different approach then normal but we had no other choice. Hopefully there is a simple solution.

    Thanks in advance

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in and have valid license to reply to this topic.

License required for the following item
Login and Registration Log in · Register