0
votes

I'm trying to move my variation description below the price but I'm having some difficulties. I know there's plenty of similair topics but non of the code provided in there seemed to work for me. I assume Woocommerce changed some stuff since then.

I tried toying with hooks but I think since this is a var it cannot be simply hooked (I'm pretty clueless in this, sorry). Some people also provided some JQuery codes but non of them worked as well. What I want to achive: 1. Remove the variation description from it's original place 2. Place it under the tittle/price (woocommerce_single_product_summary)

What I tried:

How To Move Product Variation Descriptons in WooCommerce

Move the variation description to the Woocommerce product variable description

And a code I found on github:

 add_action('plugins_loaded', 'move_variation_description', 50);

function move_variation_description(){ 
  // Remove the hook from the original location
  remove_action( 'woocommerce_single_product_summary', array( WC_Variation_Description::get_instance()->frontend, 'add_variation_description' ), 25 );
  // Re-add the hook to where you want it to be
  add_action( 'woocommerce_before_single_product_summary',  array( WC_Variation_Description::get_instance()->frontend, 'add_variation_description' ), 25 );
}
1
hi and welcome to SO, can you provide samples of what you tried? Also make sure to read these guidelines How to AskLuckyLikey
I edited my post in which I added what I tried already.ChaosweaverV2

1 Answers

1
votes

Copy file from \wp-content\plugins\woocommerce\templates\single-product\add-to-cart\variation.php to your theme's \woocommerce\single-product\add-to-cart\variation.php

  // if folders are not created then create in this manner and copy the file.

Now here you need to change the position like below one.

    <div class="woocommerce-variation-price">{{{ data.variation.price_html }}}</div>
    <div class="woocommerce-variation-description">{{{ data.variation.variation_description }}}</div>
    <div class="woocommerce-variation-availability">{{{ data.variation.availability_html }}}</div>