Errors with variations and Custom template
-
I am using a custom template to display products from specific categories in a table instead of the default layout. The table includes columns for the price of each variation.
Since the update I am now seeing this error
Notice: regular_price was called incorrectly. Product properties should not be accessed directly. Please see Debugging in WordPress for more information. (This message was added in version 3.0.) in /home/magus/web/members.magistercs.co.uk/public_html/wp-includes/functions.php on line 4137
This is the code I am using to get the prices
$available_variations = $product->get_available_variations(); $my_prices = array(); foreach ($available_variations as $variable_product) { $my_product = new WC_Product_Variation( $variable_product['variation_id']); $my_prices[] = $my_product->regular_price; }
What would be the new way of achieving this without the error?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Errors with variations and Custom template’ is closed to new replies.