Add Siti Delivery Time Notices plugin and related functionality
All checks were successful
Build & Release Plugin / release (push) Successful in 8s
All checks were successful
Build & Release Plugin / release (push) Successful in 8s
- Create main plugin file with metadata and initialization logic. - Implement SitiDeliveryTimeNotice class for managing delivery time settings. - Add JavaScript for updating delivery time notices on product pages. - Update GitHub Actions workflow to reflect new file structure. - Remove deprecated master-file.php.
This commit is contained in:
41
assets/js/levertijden.js
Normal file
41
assets/js/levertijden.js
Normal file
@@ -0,0 +1,41 @@
|
||||
(function ($) {
|
||||
$(function () {
|
||||
var $card = $('.lb-levertijd-card');
|
||||
if (!$card.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
var $text = $card.find('.lb-levertijd-text');
|
||||
var defaultText = $card.data('defaultText') || '';
|
||||
var $form = $('.variations_form');
|
||||
|
||||
function updateCard(text) {
|
||||
if (!text) {
|
||||
$card.toggleClass('lb-levertijd-hidden', true).hide();
|
||||
return;
|
||||
}
|
||||
|
||||
$text.text(text);
|
||||
$card.toggleClass('lb-levertijd-hidden', false).show();
|
||||
}
|
||||
|
||||
if (!$form.length) {
|
||||
updateCard(defaultText);
|
||||
return;
|
||||
}
|
||||
|
||||
updateCard(defaultText);
|
||||
|
||||
$form.on('found_variation', function (event, variation) {
|
||||
if (variation && variation.lb_levertijd) {
|
||||
updateCard(variation.lb_levertijd);
|
||||
} else {
|
||||
updateCard(defaultText);
|
||||
}
|
||||
});
|
||||
|
||||
$form.on('reset_data hide_variation', function () {
|
||||
updateCard(defaultText);
|
||||
});
|
||||
});
|
||||
}(jQuery));
|
||||
Reference in New Issue
Block a user