Product cart design - by Yasir Alam 8Theme

This topic has 5 replies, 3 voices, and was last updated 2 weeks, 5 days ago ago by Luca Rossi

  • Avatar: Yasir Alam 8Theme
    Yasir Alam 8Theme
    Participant
    April 6, 2025 at 15:04

    Please Check the Private content area

    Please, contact administrator
    for this information.
    Files is visible for topic creator and
    support staff only.
    4 Answers
    Avatar: Justin
    Luca Rossi
    Support staff
    April 7, 2025 at 07:43

    Hi @Yasir Alam 8Theme,

    Please try adding the following code under functions.php file locates in your child theme:

    
    add_filter('woocommerce_format_sale_price', 'add_sale_price_percentage', 20, 3 );
    function add_sale_price_percentage( $price, $regular_price, $sale_price ){
    	// Strip html tags and currency (we keep only the float number)
    	$regular_price = strip_tags( $regular_price );
    	$regular_price = (float) preg_replace('/[^0-9.]+/', '', $regular_price);
    	$sale_price = strip_tags( $sale_price );
    	$sale_price = (float) preg_replace('/[^0-9.]+/', '', $sale_price);
    
    	// Percentage text and calculation
    	$percentage = round( ( $regular_price - $sale_price ) / $regular_price * 100 );
    
    	// return on sale price range with "Save " and the discounted percentage
    	return $price . ' <span class="save-percent">' . $percentage . '% OFF</span>';
    }
    

    Hope it helps!

    Avatar: Yasir Alam 8Theme
    Yasir Alam 8Theme
    Participant
    April 7, 2025 at 14:43

    .

    Please contact administrator
    for this information.
    Avatar: Ronny
    Ronny
    Participant
    April 7, 2025 at 20:13

    Video in the private area

    Please contact administrator
    for this information.
    Avatar: Justin
    Luca Rossi
    Support staff
    April 8, 2025 at 07:12

    Dear @Yasir Alam (8Theme),

    We have reviewed the matter and noticed that the custom CSS has already been added, as shown in the following screenshot:

    https://prnt.sc/91Qe31N3aVBc


    @Ronny
    : Kindly proceed to create a separate support ticket for further assistance.

    Thank you for your attention to this matter.

    Best regards,
    The 8Theme Team

  • Viewing 5 results - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.Log in/Sign up

Helpful Topics

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.