Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Change price fields for Fanatics merchant
- */
- add_filter( 'dfrpswc_filter_postmeta_array', 'mycode_fix_fanatics_price', 20, 5 );
- function mycode_fix_fanatics_price( $meta, $post, $product, $set, $action ) {
- // Handle price.
- if ( isset( $product['retailprice'] ) ) {
- $meta['_regular_price'] = dfrps_int_to_price( $product['retailprice'] );
- $meta['_price'] = dfrps_int_to_price( $product['retailprice'] );
- // Handle sale price.
- if ( isset( $product['price'] ) ) {
- $meta['_sale_price'] = dfrps_int_to_price( $product['price'] );
- $meta['_price'] = dfrps_int_to_price( $product['price'] );
- $meta['_dfrps_salediscount'] = ( ( ( $meta['_price'] - $meta['_sale_price'] ) / $meta['_price'] ) * 100 );
- }
- }
- return $meta;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement