{"id":1095,"date":"2020-03-31T13:25:47","date_gmt":"2020-03-31T11:25:47","guid":{"rendered":"https:\/\/www.welaunch.io\/en\/?p=1095"},"modified":"2020-06-20T12:28:25","modified_gmt":"2020-06-20T10:28:25","slug":"show-msrp-price-in-woocommerce-wp-lister-for-amazon","status":"publish","type":"post","link":"https:\/\/www.welaunch.io\/en\/2020\/03\/show-msrp-price-in-woocommerce-wp-lister-for-amazon\/","title":{"rendered":"Show MSRP Price in WooCommerce WP-Lister for Amazon"},"content":{"rendered":"

If you use the WP Lister for Amazon plugin you are able to set a custom MSRP price for products. But these do not show as stroke trough price if you enter a regular or sale price.<\/p>\n

Add the below code into your functions.php and the regular price will always show the MSRP price if set.<\/p>\n

\r\n\/**\r\nChange on sale to true if MSRP is set, otherwise price only shows regular\r\n**\/\r\nadd_filter( 'woocommerce_product_is_on_sale', 'we_msrp_on_sale', 10, 1);\r\nfunction we_msrp_on_sale($onsale) {\r\n\r\n    global $product;\r\n    if(!$product) {\r\n        return $onsale;\r\n    }\r\n\r\n    $rrp = get_post_meta( $product->get_id(), '_msrp_price', true );\r\n    if($rrp) {\r\n        $price = $product->get_regular_price();\r\n        $onsale = true;\r\n    }\r\n\r\n    $variable_rrp = get_post_meta( $product->get_id(), 'variable_msrp', true );\r\n    if($variable_rrp) {\r\n        $price = $variable_rrp;\r\n        $onsale = true;\r\n    }\r\n\r\n    return $onsale;\r\n}\r\n\r\n\/**\r\nSale price will be regular price if msrp is set\r\n**\/\r\nadd_filter( 'woocommerce_product_get_sale_price', 'we_msrp_sale_price', 10, 1);\r\nfunction we_msrp_sale_price($price) {\r\n    global $product;\r\n    if(!$product) {\r\n        return $price;\r\n    }\r\n\r\n    $rrp = get_post_meta( $product->get_id(), '_msrp_price', true );\r\n    if($rrp) {\r\n        $price = $product->get_regular_price();\r\n    }\r\n\r\n    $variable_rrp = get_post_meta( $product->get_id(), 'variable_msrp', true );\r\n    if($variable_rrp) {\r\n        $price = $variable_rrp;\r\n    }\r\n\r\n    return $price;\r\n}\r\n\r\n\/**\r\n\r\n**\/\r\nadd_filter( 'woocommerce_product_get_regular_price', 'we_msrp_price', 10, 1);\r\nfunction we_msrp_price($price) {\r\n\r\n    global $product;\r\n    if(!$product) {\r\n        return $price;\r\n    }\r\n\r\n    $rrp = get_post_meta( $product->get_id(), '_msrp_price', true );\r\n    if($rrp) {\r\n        $price = $rrp;\r\n    }\r\n\r\n    $variable_rrp = get_post_meta( $product->get_id(), 'variable_msrp', true );\r\n    if($variable_rrp) {\r\n        $price = $variable_rrp;\r\n    }\r\n\r\n    return $price;\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"

If you use the WP Lister for Amazon plugin you are able to set a custom MSRP price for products. But these do not show as stroke trough price if you enter a regular or sale price. Add the below code into your functions.php and the regular price will always show the MSRP price if…<\/p>\n","protected":false},"author":1,"featured_media":2749,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-1095","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-woocommerce"],"_links":{"self":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/posts\/1095","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/comments?post=1095"}],"version-history":[{"count":1,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/posts\/1095\/revisions"}],"predecessor-version":[{"id":1096,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/posts\/1095\/revisions\/1096"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/media\/2749"}],"wp:attachment":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/media?parent=1095"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/categories?post=1095"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/tags?post=1095"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}