Discount percentage info column
-
Hi there,
We are simply using your plugin to show a variant table with extra info.
Only the columns ‘Description’ and ‘Price’ are enabled. But we would like to add a third column, which isn’t available (yet). Called ‘Discount percentage’ to see how much a customer saves.Example preview:
Is there a way to achieve this? We have a code snipped ready, but it does not seem to work when placed in inc/table-parts/content-tbody.php
Something like this:function custom_variation_price_saving_percentage( $data, $product, $variation ) { $active_price = $data['display_price']; $regular_price = $data['display_regular_price']; if( $active_price !== $regular_price ) { $saving_percentage = round( 100 - ( $active_price / $regular_price * 100 ), 1 ) . '%'; $data['price_html'] .= sprintf( __('You Saved: %s', 'woocommerce' ), $saving_percentage ); } return $data; }
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Discount percentage info column’ is closed to new replies.