• Hi,

    I would like to know if it is possible to add the non-discounted price in a <del> tag or something similar to indicate to the customer that this option is in sales ?

    I searched a bit in the HTML but there is nothing that has the “original” price (like a data-normal-price attribute in the .choice-extra-price span element).

    How can this be done ?

    Thanks

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter maxlwhp

    (@maxlwhp)

    Hi,

    I just noticed that my issue is not the display of the non-discounted price, but that the prices in the Configurator with the Extra Price addon don’t display a discount when the Woo Discount Rules plugin by Flycart adds a discount.

    I looked a bit in the code of the addon, and there’s a woo_discounts_compat function that checks if a Wdr\App\Routerclass exists, and adapts the actions in consequence. But it would seem that this function is never called or don’t work properly, as the prices in the configurator aren’t discounted.

    Thanks

    Plugin Contributor Marc Lacroix

    (@marcusig)

    Hi there,

    At the moment, the compatibility with woo_discounts_compat is only for products in the cart, it doesn’t affect the prices displayed in the configurator.

    Can you give more information about how the discounts are applied?

    Marc

    Thread Starter maxlwhp

    (@maxlwhp)

    Hi,

    Ok thank you for the fast answer.

    The discounts are applied by the Woo Discount Rules menu, with a store wide discount of -10% for testing purposes (on the staging website).

    Do you have any plan to add the compatibility in prices displayed in the configurator ? If not, or not immediately, could you indicate to me where the price is “sent” to the front, so I can try to tinker this while the addon doesn’t have this capability ?

    Thanks,

    Max

    Plugin Contributor Marc Lacroix

    (@marcusig)

    Do you have any plan to add the compatibility in prices displayed in the configurator ?

    I won’t be able to add this in the near future, as I have several higher priority features.

    You can filter the configurator data using this filter:

    apply_filters( 'mkl_pc_get_configurator_data', $config_data, $product_id );

    or

    return apply_filters( 'mkl_product_configurator_get_front_end_data', $init_data, $product );

    You can see an example of this last one here.

    You can then change the extra_price value, or anything else.

    You can also add the extra price back in the data (e.g. extra_price_regular) and use it in the front end with the <del> tag.

    Then you can modify the extra price template using one of the actions. For example, this will add a <del> tag after the price:

    add_action( 'tmpl-mkl-pc-extra-price--after', 'add_regular_price_after_ep' );
    
    function add_regular_price_after_ep(){
        echo '
        <# if ( data.extra_price_regular ) { #>
        <del class="reg-price">PC.utils.formatMoney( data.extra_price_regular )</del>
        <# } #>
        '
    }

    Thread Starter maxlwhp

    (@maxlwhp)

    Hi,

    Are you sure these hooks exist/work ? I did a function to filter the products, which does filter them when I test it out, but the hooks aren’t triggered when I do a add_filterand don’t appear when I print $wp_filters.

    Or maybe I didn’t understood how your plugin works, which is very possible as I’m kinda new to the “change things that come from plugins” thing.

    I just put this simple code in my child theme’s functions.php to see if the hooks were triggered, but it seem like they don’t :

    add_filter( 'mkl_product_configurator_get_front_end_data', 'mkl_front_filter', 10, 2 );
    
    function mkl_front_filter ($init_data, $product) {
    	echo "in front filter";
    	print_r($init_data, $product);
    }
    Plugin Contributor Marc Lacroix

    (@marcusig)

    Hi Max,

    Yes these hooks do exist and work ??

    There are a couple of things to consider:

    NB: there seems to be an issue with that data, which appears to be GZIPed twice. To resolve this, go to Settings > Product Configurator > General options, and enable the setting “Disable GZIP compression of the configuration data (only affects the ajax request)”

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to display the non-discounted price on the configurator ?’ is closed to new replies.