Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
# WordPress Coding Standards
# https://make.wordpress.org/core/handbook/best-practices/coding-standards/
# EditorConfig is awesome: https://EditorConfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
tab_width = 4
indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab
indent_size = 4

[*.txt]
trim_trailing_whitespace = false

[*.{md,json,yml}]
trim_trailing_whitespace = false
[*.{yml,yaml,json}]
indent_style = space
indent_size = 2

[*.json]
[*.{scss,css,js}]
indent_style = tab
indent_size = 4

[*.md]
trim_trailing_whitespace = false
29 changes: 0 additions & 29 deletions .eslintrc.js

This file was deleted.

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
# ───────────────────────────────
node_modules/
vendor/
composer.lock

# Catch All ( Miscellaneous )
# ───────────────────────────────
Expand Down
3 changes: 0 additions & 3 deletions .prettierrc.js

This file was deleted.

Binary file added assets/images/plugin-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions assets/src/js/frontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@
const GALLERY_IMAGE_SELECTOR = '.woocommerce-product-gallery__image';

/**
* Event: On variation select blur
* Event: On variation found
* Handles updating the product gallery with variation-specific images.
* Uses WooCommerce's found_variation event so the variation ID is available.
*/
$(VARIATION_FORM_SELECTOR).on('blur', VARIATION_SELECT_SELECTOR, function () {
$(VARIATION_FORM_SELECTOR).on('found_variation', function (event, variation) {
const productId = $(VARIATION_FORM_SELECTOR).data('product_id');
const variationId = $(VARIATION_INPUT_SELECTOR).val();
const variationId = variation.variation_id;
const $gallery = $(GALLERY_SELECTOR);
const $galleryImage = $(GALLERY_IMAGE_SELECTOR);

Expand Down
36 changes: 14 additions & 22 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,57 +3,49 @@
"type": "wordpress-plugin",
"license": "GPL-2.0-or-later",
"repositories": [
{
"type": "vcs",
"url": "git@github.com:byteever/bytekit-plugin.git"
},
{
"type": "vcs",
"url": "git@github.com:byteever/bytekit-settings.git"
}
{ "type": "vcs", "url": "git@github.com:byteever/plugin.git" }
],
"require": {
"php": ">=7.4",
"byteever/bytekit-plugin": "dev-trunk",
"byteever/bytekit-settings": "dev-trunk"
"byteever/plugin": "^1.0"
},
"require-dev": {
"byteever/byteever-sniffs": "^1.1.3"
},
"autoload": {
"psr-4": {
"WooCommerceVariationImages\\": "includes/"
"PluginEver\\VariationImages\\": "includes/"
}
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"platform": {
"php": "7.4"
},
"sort-packages": true
},
"scripts": {
"post-install-cmd": "@strauss",
"post-update-cmd": "@strauss",
"post-autoload-dump": "test -f /tmp/strauss.phar && php /tmp/strauss.phar include-autoloader || true",
"makepot": "wp --allow-root i18n make-pot . --include=*.php,assets,includes,templates --domain=wc-variation-images",
"phpcs": "php ./vendor/bin/phpcs --standard=phpcs.xml -s -v",
"phpcbf": "php ./vendor/bin/phpcbf --standard=phpcs.xml -v",
"test:setup": "bash ./bin/setup-tests.sh wordpress_test root root localhost trunk && phpunit",
"test": "phpunit",
"phpcs": "phpcs --standard=phpcs.xml -s",
"phpcbf": "phpcbf --standard=phpcs.xml",
"strauss": [
"test -f /tmp/strauss.phar || curl -o /tmp/strauss.phar -L https://github.com/BrianHenryIE/strauss/releases/download/0.24.1/strauss.phar",
"@php /tmp/strauss.phar",
"@composer dump-autoload --no-scripts",
"find ./vendor/byteever -type f -name '*.php' -exec perl -i -pe \"s/'bytekit-textdomain'/'wc-variation-images'/g\" {} +"
"@composer dump-autoload --no-scripts"
]
},
"extra": {
"strauss": {
"target_directory": "vendor",
"namespace_prefix": "WooCommerceVariationImages\\",
"classmap_prefix": "WooCommerceVariationImages__",
"namespace_prefix": "PluginEver\\VariationImages\\",
"classmap_prefix": "PluginEver_VariationImages__",
"packages": [
"byteever/bytekit-plugin",
"byteever/bytekit-settings"
"byteever/plugin"
]
}
}
Expand Down
Loading
Loading