This file contains 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
function enqueue_script() | |
{ | |
$version = '1.0.0'; | |
if (is_product()) { | |
wp_enqueue_script('single-variation-form', get_stylesheet_directory_uri() . '/js/single-variation-form.js', ['jquery', 'vi-wpvs-frontend-script'], $version, true); | |
} | |
} | |
add_action('wp_enqueue_scripts', 'enqueue_script'); |
This file contains 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
add_action('woocommerce_remove_cart_item', 'remove_added_to_cart_message_for_product', 10, 2); | |
function remove_added_to_cart_message_for_product($cart_item_key, $cart) | |
{ | |
$product_id = $cart->removed_cart_contents[$cart_item_key]['product_id']; | |
$product = wc_get_product($product_id); | |
if (!$product) { | |
return; | |
} |
This file contains 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
(function(window, document, $) { | |
'use strict'; | |
function handleVariationChange() { | |
$('.variations_form .avada-select-wrapper').each(function() { | |
const $wrapper = $(this); | |
const $buttons = $wrapper.find('.avada-button-select:not([data-disabled="true"])'); | |
const $checkedButtons = $buttons.filter('[data-checked="true"]'); | |
if ($buttons.length === 1 && !$buttons.attr('data-prevent-auto-select')) { |