Skip to content

Instantly share code, notes, and snippets.

View Ebrahim6's full-sized avatar

Md Ebrahim Khalil Ebrahim6

View GitHub Profile
@Ebrahim6
Ebrahim6 / variation_table
Created July 18, 2019 13:24 — forked from rsangeethk/variation_table
Woocommerce Display all Variations as table
//Display variation dropdown as table
function woocommerce_variable_add_to_cart() {
global $product, $post;
$variations = $product->get_available_variations();
foreach ($variations as $key => $value) {
?>
<form action="<?php echo esc_url( $product->add_to_cart_url() ); ?>"method="post" enctype='multipart/form-data'>
<input type="hidden" name="variation_id" value="<?php echo $value['variation_id']?>" />
<input type="hidden" name="product_id" value="<?php echo esc_attr( $post->ID ); ?>" />
<?php