• Hello,

    I use the RightPress Woocommerce Dynamic Pricing & Discounts extension.

    I have a problem with a dynamic price that does not apply to variable products. I contacted RightPress support who think the problem is how the OceanWp theme adds products to the cart.
    It would seem that not all the cart item properties are set by default. In the case of variable products, variation_id is well defined, but the product_id of the parent product is missing.

    Can you tell me how I can add the product_id in the cart items data?

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter punkadelic

    (@punkadelic)

    I found a solution :

    In oceanwp > inc > woocommerce > woocommerce-config.php

    In function add_cart_single_product_ajax() (line 690), I added two lines like this :

    public static function add_cart_single_product_ajax() {
    
    	$product_id   = sanitize_text_field( $_POST['product_id'] );
    	$variation_id = sanitize_text_field( $_POST['variation_id'] );
    	$variation    = $_POST['variation'];
    	$quantity     = sanitize_text_field( $_POST['quantity'] );
    
    	if ( $variation_id ) {
    		$product_variation = wc_get_product( sanitize_text_field( $_POST['variation_id'] ) );
    		$product_id = $product_variation->get_parent_id();
    		...

    How can I get this modification into my child theme ?

    Thank you

    Theme Author oceanwp

    (@oceanwp)

    Hello, I would need to do some test to include those new lines, can you open a pre-purchase ticket in oceanwp.org? I will ask you more information.
    thank you.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Compatibility problem with an extension’ is closed to new replies.