Skip to content

Commit

Permalink
Better compatibility Fluid Checkout for WooCommerce – Lite solution
Browse files Browse the repository at this point in the history
  • Loading branch information
vyskoczilova committed Jan 9, 2024
1 parent b12eddb commit 2afc658
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 4 deletions.
37 changes: 36 additions & 1 deletion assets/js/public.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,42 @@
if (woolab.ares_fill) {
// Compatibility with Fluid Checkout for WooCommerce – Lite
if ($('#billing_same_as_shipping') && $('#billing_same_as_shipping').is(':checked')) {
$('#billing_same_as_shipping').click();
// Check whether the CollapsibleBlock library is available
if (window.CollapsibleBlock) {
// Set billing address as different from shipping address
var fc_billing_same_as_shipping_field = document.querySelector('#billing_same_as_shipping');
fc_billing_same_as_shipping_field.checked = false; // Expand the billing address fields

var fc_billing_address_fields_wrapper = document.querySelector('#woocommerce-billing-fields__field-wrapper');

if (fc_billing_address_fields_wrapper) {
CollapsibleBlock.expand(fc_billing_address_fields_wrapper);
} // Get company field toggle and content elements


var fc_billing_company_toggle = document.querySelector('#fc-expansible-form-section__toggle-plus--billing_company');
var fc_billing_company_content = document.querySelector('#fc-expansible-form-section__content--billing_company'); // Expand the billing company field

if (fc_billing_company_toggle) {
CollapsibleBlock.collapse(fc_billing_company_toggle);
}

if (fc_billing_company_content) {
CollapsibleBlock.expand(fc_billing_company_content);
} // Get dic field toggle and content elements


var fc_billing_dic_toggle = document.querySelector('#fc-expansible-form-section__toggle-plus--billing_dic');
var fc_billing_dic_content = document.querySelector('#fc-expansible-form-section__content--billing_dic'); // Expand the billing dic field

if (fc_billing_dic_toggle) {
CollapsibleBlock.collapse(fc_billing_dic_toggle);
}

if (fc_billing_dic_content) {
CollapsibleBlock.expand(fc_billing_dic_content);
}
}
} // Update values


Expand Down
2 changes: 1 addition & 1 deletion assets/js/public.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 33 additions & 2 deletions src/js/public.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,40 @@
if ( woolab.ares_fill ) {

// Compatibility with Fluid Checkout for WooCommerce – Lite
// https://wordpress.org/support/topic/compatibility-with-kybernaut-ico-dic-plugin/
if ($('#billing_same_as_shipping') && $('#billing_same_as_shipping').is(':checked')) {
$('#billing_same_as_shipping').click();
$('#fc-expansible-form-section__toggle-plus--billing_company').click();

// Check whether the CollapsibleBlock library is available
if ( window.CollapsibleBlock ) {

// Set billing address as different from shipping address
var fc_billing_same_as_shipping_field = document.querySelector( '#billing_same_as_shipping' );
fc_billing_same_as_shipping_field.checked = false;

// Expand the billing address fields
var fc_billing_address_fields_wrapper = document.querySelector( '#woocommerce-billing-fields__field-wrapper' );
if ( fc_billing_address_fields_wrapper ) {
CollapsibleBlock.expand( fc_billing_address_fields_wrapper );
}

// Get company field toggle and content elements
var fc_billing_company_toggle = document.querySelector( '#fc-expansible-form-section__toggle-plus--billing_company' );
var fc_billing_company_content = document.querySelector( '#fc-expansible-form-section__content--billing_company' );

// Expand the billing company field
if ( fc_billing_company_toggle ) { CollapsibleBlock.collapse( fc_billing_company_toggle ); }
if ( fc_billing_company_content ) { CollapsibleBlock.expand( fc_billing_company_content ); }

// Get dic field toggle and content elements
var fc_billing_dic_toggle = document.querySelector( '#fc-expansible-form-section__toggle-plus--billing_dic' );
var fc_billing_dic_content = document.querySelector( '#fc-expansible-form-section__content--billing_dic' );

// Expand the billing dic field
if ( fc_billing_dic_toggle ) { CollapsibleBlock.collapse( fc_billing_dic_toggle ); }
if ( fc_billing_dic_content ) { CollapsibleBlock.expand( fc_billing_dic_content ); }

}

}

// Update values
Expand Down

0 comments on commit 2afc658

Please sign in to comment.