• Resolved manchovie

    (@manchovie)


    Builderius UniCPO is an excellent plug in that allows you to use complex rules to calculate prices of products based on form inputs, including sliders etc.
    https://builderius.io/cpo/

    It was nicely compatible with Advanced Dynamic Pricing for WooCommerce up to ADPW v3.3.2.

    When you use UniCPO, each product still needs a “Regular price ($)” entered in the backend as usual. This seems to let Woocommerce function as expected, even though in practice UniCPO overrides this price, and you should never actually see it on the front end.

    At 4.0 ADPW began to add discounts to the default Woocommerce product price rather than the price calculated by UniCPO. In the cart you can see the UniCPO calculated price crossed out correctly, but the discounted price is not based on this figure.

    E.g. for different variations of the same product it might look something like this in the cart, when it should instead be adding a 20% discount to the initial figure.
    $181.00 $140.00
    $361.00 $140.00
    $296.00 $140.00

    I’d love to be able to update to the latest version but I wonder if there is some code I can use to make it behave as per v3 in this regard.

    • This topic was modified 2 years, 6 months ago by manchovie.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support thisisirene

    (@thisisirene)

    Hello!

    Here’s a hook for UNICpo compatibility: https://www.dropbox.com/s/rlgk0mbo2lrohk4/unicpo.txt?dl=0

    Please, test it on the staging site with the latest version of our plugin. Insert this code as snippet using Code Snippets plugin.

    • This reply was modified 2 years, 6 months ago by thisisirene.
    Thread Starter manchovie

    (@manchovie)

    Hi @thisisirene

    Thanks so much for providing that snippet!

    I have updated your plugin to the latest and added the provided code via the Code Snippet plugin.

    It doesn’t seem to be doing anything though. No errors are shown in debug mode. Would you like a log in to my staging site?

    Plugin Support thisisirene

    (@thisisirene)

    Please, send us information as a new ticket via helpdesk. Thank you!

    • This reply was modified 2 years, 6 months ago by thisisirene.
    Thread Starter manchovie

    (@manchovie)

    Thanks and done. ??

    Thread Starter manchovie

    (@manchovie)

    For anyone coming here via a search — huge thanks to @thisisirene from Algoplus for working on this and providing a solution. Here is code for your functions.php or Code Snippets plugin.

    add_filter("adp_product_get_price", function ($price, $product, $variation, $qty, $thirdPartyData) {
        if (isset($thirdPartyData['_cpo_price'])) {
            $product_id = $product->get_id();
            $product_data = Uni_Cpo_Product::get_product_data_by_id($product_id);
    
            if ('on' === $product_data['settings_data']['cpo_enable'] && 'on' === $product_data['settings_data']['calc_enable']) {
                $price = $thirdPartyData['_cpo_price'];
            }
        }
    
        return $price;
    }, 10, 5);
    add_filter('uni_cpo_ajax_calculated_price', function ($price_calculated, $product, $filtered_form_data) {
        if (function_exists("adp_functions")) {
            (new \ADP\BaseVersion\Includes\ProductExtensions\ProductExtension($product))->setCustomPrice($price_calculated);
            $calculatedProduct = adp_functions()->calculateProduct($product, 1, false);
            $price_calculated = $calculatedProduct->getCalculatedPrice();
        }
    
        return $price_calculated;
    }, 10, 3);
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Incompatible with Builderius UniCPO since v4.0’ is closed to new replies.