0

enter image description here

I want to swap the Product attribute size and Price. The Price should display above the Size. I am new to the woocommerce , is it possible to do that with hook?

kd patel
  • 607
  • 1
  • 6
  • 15
  • Thanks for your suggestion. But I did it, I can swap the whole (woocommerce_template_single_add_to_cart) hook which includes the size, price and add to cart button. but I don't know how to swap internal elements of the hook. – kd patel May 25 '17 at 13:12
  • https://wordpress.stackexchange.com/questions/206655/woocommerce-change-display-order-of-product-short-description-and-price Seems all about priorities, although there are also SO answers where the template code is used https://stackoverflow.com/questions/37610962/woocommerce-change-position-of-price. Work on your search skills – RST May 25 '17 at 13:23
  • Thanks, but I saw that link before, the example shown in the link are totally 2 different actions 1) woocommerce_template_single_price 2) woocommerce_template_single_excerpt . But in my case the elements that i want to swap belongs to same action 1) woocommerce_template_single_add_to_cart . Did i clear your point ? – kd patel May 25 '17 at 13:28
  • So unset that action and set new ones in the correct order. The links were not to hand you the answer on a plate but to supply some info on the system in general. Keep in mind this is a code problem solving forum. There is no code to solve in your post, just a WooCommerce question. – RST May 25 '17 at 13:36

1 Answers1

0

Got the answer:

remove_action('woocommerce_single_variation','woocommerce_single_variation',10); add_action('woocommerce_before_variations_form', 'woocommerce_single_variation',20);

kd patel
  • 607
  • 1
  • 6
  • 15