sale price of woocommerce have any value and that is not less than the regular price

0

I want to change the value of "sale price" of the products so that I do not get an error when I put it higher than the "Regular price", how could I do this? Using PHP in the woocommerce code or installing a plugin?

I've been looking at the plugin code and this is what I have in function.php:

function bd_rrp_sale_price_html( $price, $product ) {

if ( $product->is_on_sale() ) :
$has_sale_text = array(
'<del>' => '<del><span class="arprice">MSRP:</span>',
'<ins>' => '<ins><span class="arprice"> Our Price : </span>'
);
$return_string .= str_replace(array_keys( $has_sale_text ), array_values( $has_sale_text ), $price);

else :
$retun_string = $price;
endif;

$return_string.='<span class="arprice hh">PRE-OWNED : Call For Quote </span>';

return $return_string;
}
add_filter( 'woocommerce_get_price_html', 'bd_rrp_sale_price_html', 100, 2 );

I'm also looking at the woocommerce plugin code to find the variable from there.

    
asked by Juan Fernando Garcia zapata 31.05.2017 в 17:42
source

1 answer

1

Without having to modify the plugin code, I would directly believe that you can modify the price of the products by database. It is not a recommended practice, but it is a temporary solution.

UPDATE wp_postmeta AS s
SET s.meta_value = 'el valor que usted quiera'
WHERE s.meta_key = '_sale_price'
AND s.post_id = 'el id que ud encontró'

The wp_postmeta table is the one that contains the prices of the products created in woocommerce.

meta_key is the column that has the field '_sale_price' and meta_value is who has the value of the sale price.

It only requires knowing the id of the product you want to update and then executing the query on the database related to the woocommerce.

    
answered by 01.06.2017 в 22:40