• Resolved enpixelate

    (@enpixelate)


    I absolutely love this plug-in. Works great. I have it set to display the “From $12.49 $24.95” on the product catalog. On the actual product page, it says “$12.49 $24.95” for the price. Is it possible to use a snippet to make it say “Your Discounted Price: $12.49 ea. (MSRP $24.95)”? I essentially just want to customize how the price looks on the product page. I didn’t see that as an option in the settings but I thought I could use a snippet. I just don’t know enough about WordPress and Plug-in code to write a snippet myself. Anyway, great work and thanks for an awesome plug-in!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author algol.plus

    (@algolplus)

    Hello

    We use a bit different hooks for different kind of rules,
    so could you upload your rules to helpdesk?

    use tab “Tools” to get them.
    thanks, Alex

    Plugin Author algol.plus

    (@algolplus)

    I’m sorry for late reply.

    Plugin Author algol.plus

    (@algolplus)

    Final code – modify price only at product page

    add_filter( 'wdp_price_display_html', function ( $price_html, $wdp_product ) {
    	/** @var WDP_Product $wdp_product */
    
    	if ( $wdp_product->are_rules_applied() && ! wp_doing_ajax() && is_product() ) {
    		$price_html = "Your Discounted Price: {{discounted_price}} ea  (MSRP {{original_price}})";
    
    		$replacements = array(
    			'{{discounted_price}}'          => wc_price($wdp_product->get_new_price()),
    			'{{original_price}}'            => wc_price($wdp_product->get_price()),
    		);
    
    		foreach ( $replacements as $search => $replace ) {
    			$price_html = str_replace( $search, $replace, $price_html );
    		}
    	}
    
    	return $price_html;
    }, 10, 2 );
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Customize Price Display’ is closed to new replies.