Change the product_preview to woocommerceBlock

This commit is contained in:
Narek Zakarian 2024-03-14 16:37:58 +04:00
parent f448fabe3c
commit 6259677855
No known key found for this signature in database
GPG key ID: 07AFD7E7A9C164A7
3 changed files with 12 additions and 9 deletions

View file

@ -40,7 +40,7 @@ class PayLaterBlockModule implements ModuleInterface {
* @return bool true if the block is enabled, otherwise false. * @return bool true if the block is enabled, otherwise false.
*/ */
public static function is_block_enabled( SettingsStatus $settings_status ): bool { public static function is_block_enabled( SettingsStatus $settings_status ): bool {
return self::is_module_loading_required() && $settings_status->is_pay_later_messaging_enabled_for_location( 'product_preview' ); return self::is_module_loading_required() && $settings_status->is_pay_later_messaging_enabled_for_location( 'woocommerceBlock' );
} }
/** /**

View file

@ -40,7 +40,10 @@ document.addEventListener( 'DOMContentLoaded', () => {
partnerClientId: PcpPayLaterConfigurator.partnerClientId, partnerClientId: PcpPayLaterConfigurator.partnerClientId,
partnerName: 'WooCommerce', partnerName: 'WooCommerce',
bnCode: 'Woo_PPCP', bnCode: 'Woo_PPCP',
placements: ['cart', 'checkout', 'product', 'shop', 'home', 'product_preview'], placements: ['cart', 'checkout', 'product', 'shop', 'home'],
custom_placement:[{
message_reference: 'woocommerceBlock',
}],
styleOverrides: { styleOverrides: {
button: publishButtonClassName, button: publishButtonClassName,
header: PcpPayLaterConfigurator.headerClassName, header: PcpPayLaterConfigurator.headerClassName,

View file

@ -22,12 +22,12 @@ class ConfigFactory {
*/ */
public function from_settings( Settings $settings ): array { public function from_settings( Settings $settings ): array {
return array( return array(
'cart' => $this->for_location( $settings, 'cart' ), 'cart' => $this->for_location( $settings, 'cart' ),
'checkout' => $this->for_location( $settings, 'checkout' ), 'checkout' => $this->for_location( $settings, 'checkout' ),
'product' => $this->for_location( $settings, 'product' ), 'product' => $this->for_location( $settings, 'product' ),
'shop' => $this->for_location( $settings, 'shop' ), 'shop' => $this->for_location( $settings, 'shop' ),
'home' => $this->for_location( $settings, 'home' ), 'home' => $this->for_location( $settings, 'home' ),
'product_preview' => $this->for_location( $settings, 'product_preview' ), 'woocommerceBlock' => $this->for_location( $settings, 'woocommerceBlock' ),
); );
} }
@ -46,7 +46,7 @@ class ConfigFactory {
'color' => $this->get_or_default( $settings, "pay_later_{$location}_message_flex_color", 'black', array( 'black', 'blue', 'white', 'white-no-border' ) ), 'color' => $this->get_or_default( $settings, "pay_later_{$location}_message_flex_color", 'black', array( 'black', 'blue', 'white', 'white-no-border' ) ),
'ratio' => $this->get_or_default( $settings, "pay_later_{$location}_message_flex_ratio", '8x1', array( '8x1', '20x1' ) ), 'ratio' => $this->get_or_default( $settings, "pay_later_{$location}_message_flex_ratio", '8x1', array( '8x1', '20x1' ) ),
); );
} else { } elseif($location !== 'woocommerceBlock') {
$config = array( $config = array(
'layout' => 'text', 'layout' => 'text',
'logo-position' => $this->get_or_default( $settings, "pay_later_{$location}_message_position", 'left' ), 'logo-position' => $this->get_or_default( $settings, "pay_later_{$location}_message_position", 'left' ),