Created
December 3, 2014 09:14
-
-
Save manchumahara/2d97d7f8dd1e86072fe9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //usages [add_to_cart_variable] | |
| add_shortcode('add_to_cart_variable', 'add_to_cart_variable_function'); | |
| function add_to_cart_variable_function(){ | |
| global $product; | |
| // Enqueue variation scripts | |
| wp_enqueue_script( 'wc-add-to-cart-variation' ); | |
| ob_start(); | |
| // Load the template | |
| wc_get_template( 'single-product/add-to-cart/variable.php', array( | |
| 'available_variations' => $product->get_available_variations(), | |
| 'attributes' => $product->get_variation_attributes(), | |
| 'selected_attributes' => $product->get_variation_default_attributes() | |
| ) ); | |
| $output = ob_get_contents(); | |
| ob_clean(); | |
| return $output; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment