Display Discount Percentage of a Product

WooCommerce's default setting shows a discount price instead of a discount percentage on your products. Oxy Ultimate Woo is providing the smart PHP function to display the offer value as percentage type.

PHP Function

ou_get_sales_off_value( string $type = 'percentage', string $prefix = '', integer $id = '' )


Description

Displaying the discount value in percentage or fixed rate.

Parameters

$type:
(string) Display type. You can show the offer value in percentage or fixed rate type. Default is "percentage".  For fixed value you will use "fixed" or "fixed_rate".

$prefix:
(string) Text. It adds some text before the discount value.

$id:
(integer) Product ID. Default value is current product ID.

Instruction

Leave a Reply

Your email address will not be published.