samedi 4 juin 2016

How to get variation price in woocommerce?

I am using woocommerce plugin in one of my website. In this there are variation prices shown on product page. but when i am trying to get them it is only giving abobe price as shown in this url have a look

The code i am using for this is

$available_variations = $product->get_available_variations();
$variation_id=$available_variations[0]['variation_id'];
$variable_product1= new WC_Product_Variation( $variation_id );
$regular_price = $variable_product1 ->regular_price;
$sales_price = $variable_product1 ->sale_price;
echo $regular_price."<br/>".$sales_price;

but it is only priniting $1499 and $599. But i want to get $1800 and $899 shown abobe add to cart button. How to get them.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire