$price_unchanged = ‘$’ . wc_get_price_to_display( $product ); return $price_unchanged; I works for all the products except for the one I created with your plugin.
How do I find the product_id so I can code just for that product_id?
The PW Gift Card product is an extension of the Variable Product type that is built into WooCommerce.
The code you provided is out of context, however I assume that $product is the parent (Variable) product and not the individual Variation. As a result, there is no ‘_regular_price’ field on the Variable product since it is on each individual Variation.
Are you able to access the specific Variation where this code is being used? That will fix the issue.
The issue you describe sounds like the Catalog Visibility for the product is marked as Shop Only. To change this, log into your WordPress admin area and click the Products menu on the left. Edit the product and look for Catalog Visibility in the top right box. Click Edit and set the visibility to “Shop and Search Results”.