diff options
Diffstat (limited to 'includes/class-cepis-woo-assets.php')
| -rw-r--r-- | includes/class-cepis-woo-assets.php | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/includes/class-cepis-woo-assets.php b/includes/class-cepis-woo-assets.php index def6fe2..503441c 100644 --- a/includes/class-cepis-woo-assets.php +++ b/includes/class-cepis-woo-assets.php @@ -27,6 +27,15 @@ final class Cepis_Woo_Assets { private const WIDGET = 'cepis-autofill'; /** + * Script handle for the shared "which municipality was that" helper. + * + * Its own file rather than a copy inside each integration: both checkouts + * need it, there is no build step to share code for them, and one module + * means one cache of what has already been asked. + */ + private const FAIXA = 'cepis-woocommerce-faixa'; + + /** * Hook the enqueue. */ public static function init(): void { @@ -51,10 +60,18 @@ final class Cepis_Woo_Assets { true ); + wp_register_script( + self::FAIXA, + CEPIS_WOO_URL . 'assets/js/cepis-woocommerce-faixa.js', + array(), + CEPIS_WOO_VERSION, + true + ); + $handle = 'cepis-woocommerce-' . $checkout; $dependencies = 'blocks' === $checkout - ? array( self::WIDGET, 'wp-data', 'wc-blocks-data-store' ) - : array( self::WIDGET, 'jquery' ); + ? array( self::WIDGET, self::FAIXA, 'wp-data', 'wc-blocks-data-store' ) + : array( self::WIDGET, self::FAIXA, 'jquery' ); wp_enqueue_script( $handle, |