I am trying to get woocommerce sale price meta field from the plugin woocommerce price based on country and then copy it to another custom field. The code seems to create an error? Am I getting the price in the wrong way?
if( ( $value = $product->get_meta( 'canada_sale_price' ) && ! $product->get_meta( 'customfieldprice' ) ){
$product->update_meta_data( 'customfieldprice', $value );
}
I tried also using the native regular and sale price from WooCommerce but no success...
if( ( $value = $product->get_price() || $value = $product->get_regular_price() ) ) { update_post_meta( $product_id, 'customfieldprice', $value ); }