Mark-Tomlinson / markup-by-attribute-for-woocommerce

Price markup by attribute term for WooCommerce
GNU General Public License v3.0
3 stars 3 forks source link

How to make plugin increase only the sale price and not the regular price. #21

Closed Mihir7 closed 3 years ago

Mihir7 commented 3 years ago

Hi Mark, Thanks for making and sharing this simple and sweet plugin. It works perfectly.

As per my requirement, I want the markup to increase only the sale price and not the regular price.

Can you tell me which line should I edit - so markup just increases the sale price and not the regular product price.

Thanks.

Mark-Tomlinson commented 3 years ago

That's an interesting question, but a simple one to answer.

Edit src\backend\product.php, line 79.

76    // Method is hooked into 'woocommerce_bulk_edit_variations', which runs with
77    // every bulk edit action. So we only want to execute it if the bulk action
78    // is setting the regular or sale price.
79    if ( $bulk_action == 'variable_regular_price' || $bulk_action == 'variable_sale_price' )
80    {

The edit should be pretty clear, but I'll post it here anyway.

76    // Method is hooked into 'woocommerce_bulk_edit_variations', which runs with
77    // every bulk edit action. So we only want to execute it if the bulk action
78    // is setting the regular or sale price.
79    // if ( $bulk_action == 'variable_regular_price' || $bulk_action == 'variable_sale_price' ) <== commented out
80    if ( $bulk_action == 'variable_sale_price' )
81    {
Mihir7 commented 3 years ago

Perfect. Thanks..