Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // set sale price = regular price if sale price is zero
- // should set sale price to blank?
- // needs additional error checking
- // does not work for direct access to cart page
- // intended as a framework for further development
- // code goes in functions.php for your child theme
- add_action ('woocommerce_before_shop_loop_item', 'check_sale_price', 40 );
- add_action('woocommerce_before_single_product', 'check_sale_price', 40 );
- function check_sale_price() {
- $billing_first_name = get_post_meta(3834, '_billing_first_name', true );
- print $billing_first_name;
- global $product;
- if ( $product->sale_price == '0' ) {
- $price = $product->regular_price;
- $product->sale_price = $price;
- $product->price = $price;
- global $wpdb;
- $wpdb->get_results( 'UPDATE sa_postmeta SET meta_value='.$price.' WHERE meta_key="_sale_price" AND post_id='.$product->id, OBJECT );
- $wpdb->get_results( 'UPDATE sa_postmeta SET meta_value='.$price.' WHERE meta_key="_price" AND post_id='.$product->id, OBJECT );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement