From 4ca9639fb17016f97e22b9dd5e926dc93acc1286 Mon Sep 17 00:00:00 2001 From: Alex P Date: Thu, 20 Oct 2022 13:13:42 +0300 Subject: [PATCH] Add CSS file for non-DCC rules --- modules/ppcp-button/resources/css/gateway.scss | 3 +++ .../ppcp-button/resources/css/hosted-fields.scss | 4 ---- modules/ppcp-button/src/Assets/SmartButton.php | 15 ++++++++++++--- modules/ppcp-button/webpack.config.js | 3 ++- 4 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 modules/ppcp-button/resources/css/gateway.scss diff --git a/modules/ppcp-button/resources/css/gateway.scss b/modules/ppcp-button/resources/css/gateway.scss new file mode 100644 index 000000000..0a97127ab --- /dev/null +++ b/modules/ppcp-button/resources/css/gateway.scss @@ -0,0 +1,3 @@ +#place_order.ppcp-hidden { + display: none !important; +} diff --git a/modules/ppcp-button/resources/css/hosted-fields.scss b/modules/ppcp-button/resources/css/hosted-fields.scss index d4fcdab0a..2305d313b 100644 --- a/modules/ppcp-button/resources/css/hosted-fields.scss +++ b/modules/ppcp-button/resources/css/hosted-fields.scss @@ -15,7 +15,3 @@ .ppcp-dcc-order-button { float: right; } - -#place_order.ppcp-hidden { - display: none !important; -} diff --git a/modules/ppcp-button/src/Assets/SmartButton.php b/modules/ppcp-button/src/Assets/SmartButton.php index b69417a03..89c15b90b 100644 --- a/modules/ppcp-button/src/Assets/SmartButton.php +++ b/modules/ppcp-button/src/Assets/SmartButton.php @@ -522,13 +522,22 @@ class SmartButton implements SmartButtonInterface { $load_script = true; } - if ( in_array( $this->context(), array( 'pay-now', 'checkout' ), true ) && $this->can_render_dcc() ) { + if ( in_array( $this->context(), array( 'pay-now', 'checkout' ), true ) ) { wp_enqueue_style( - 'ppcp-hosted-fields', - untrailingslashit( $this->module_url ) . '/assets/css/hosted-fields.css', + 'gateway', + untrailingslashit( $this->module_url ) . '/assets/css/gateway.css', array(), $this->version ); + + if ( $this->can_render_dcc() ) { + wp_enqueue_style( + 'ppcp-hosted-fields', + untrailingslashit( $this->module_url ) . '/assets/css/hosted-fields.css', + array(), + $this->version + ); + } } if ( $load_script ) { wp_enqueue_script( diff --git a/modules/ppcp-button/webpack.config.js b/modules/ppcp-button/webpack.config.js index 331df1d86..8e02ccaa5 100644 --- a/modules/ppcp-button/webpack.config.js +++ b/modules/ppcp-button/webpack.config.js @@ -7,7 +7,8 @@ module.exports = { target: 'web', entry: { button: path.resolve('./resources/js/button.js'), - "hosted-fields": path.resolve('./resources/css/hosted-fields.scss') + "hosted-fields": path.resolve('./resources/css/hosted-fields.scss'), + "gateway": path.resolve('./resources/css/gateway.scss') }, output: { path: path.resolve(__dirname, 'assets/'),