You've already forked wc-composable-product
Initial implementation of WooCommerce Composable Products plugin
Implemented custom WooCommerce product type allowing customers to build their own product bundles by selecting from predefined sets of products. Features: - Custom "Composable Product" type with admin interface - Product selection by category, tag, or SKU - Configurable selection limits (global and per-product) - Dual pricing modes: fixed price or sum of selected products - Modern responsive frontend with Twig templates - AJAX add-to-cart functionality - Full internationalization support (.pot file) - WooCommerce settings integration - Comprehensive documentation Technical implementation: - PHP 8.3+ with PSR-4 autoloading - Twig 3.0 templating engine via Composer - Vanilla JavaScript with jQuery for frontend interactions - WordPress and WooCommerce hooks for seamless integration - Security: input sanitization, validation, and output escaping - Translation-ready with text domain 'wc-composable-product' Documentation: - README.md: Project overview and features - INSTALL.md: Installation and usage guide - IMPLEMENTATION.md: Technical architecture - CHANGELOG.md: Version history 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
50
assets/js/admin.js
Normal file
50
assets/js/admin.js
Normal file
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* Admin JavaScript for Composable Products
|
||||
*
|
||||
* @package WC_Composable_Product
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
'use strict';
|
||||
|
||||
$(document).ready(function() {
|
||||
/**
|
||||
* Show/hide product data tab for composable products
|
||||
*/
|
||||
$('select#product-type').on('change', function() {
|
||||
const productType = $(this).val();
|
||||
|
||||
if (productType === 'composable') {
|
||||
$('.show_if_composable').show();
|
||||
$('.hide_if_composable').hide();
|
||||
$('#composable_product_data').show();
|
||||
$('.product_data_tabs .composable_options a').show();
|
||||
} else {
|
||||
$('.show_if_composable').hide();
|
||||
$('#composable_product_data').hide();
|
||||
$('.product_data_tabs .composable_options a').hide();
|
||||
}
|
||||
}).trigger('change');
|
||||
|
||||
/**
|
||||
* Toggle criteria groups based on selected type
|
||||
*/
|
||||
$('#_composable_criteria_type').on('change', function() {
|
||||
const criteriaType = $(this).val();
|
||||
|
||||
$('.composable_criteria_group').hide();
|
||||
$('#composable_criteria_' + criteriaType).show();
|
||||
}).trigger('change');
|
||||
|
||||
/**
|
||||
* Initialize enhanced select for categories and tags
|
||||
*/
|
||||
if ($.fn.selectWoo) {
|
||||
$('#_composable_categories, #_composable_tags').selectWoo({
|
||||
placeholder: 'Select options...',
|
||||
allowClear: true
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
Reference in New Issue
Block a user