Skip to content

Commit

Permalink
fix: center iframe on success screen (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
timjackleus authored Dec 16, 2023
1 parent e0e9060 commit 5c288d0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 27 deletions.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16.17.1
16 changes: 8 additions & 8 deletions assets/scss/ledyer-checkout-for-woocommerce.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
display: flex;
flex-direction: column;
align-items: center;
}

#lco-order-review,
#lco-iframe {
width: 100%;
}
#lco-order-review,
#lco-iframe {
width: 100%;
}

#lco-iframe {
display: flex;
justify-content: center;
}
#lco-iframe {
display: flex;
justify-content: center;
}
33 changes: 14 additions & 19 deletions classes/class-ledyer-lco-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,19 @@ public function enqueue_scripts() {
return;
}

// Load the Ledyer Checkout for WooCommerce stylesheet.
wp_register_style(
'lco',
plugins_url('build/ledyer-checkout-for-woocommerce.css', LCO_WC_MAIN_FILE),
array(),
filemtime(plugin_dir_path(LCO_WC_MAIN_FILE) . ('build/ledyer-checkout-for-woocommerce.css'))
);
wp_enqueue_style('lco');

if ( ! is_checkout() ) {
return;
}


$scriptSrcUrl = 'https://checkout.live.ledyer.com/bootstrap.js';

if ( $this->testmode ) {
Expand All @@ -120,7 +128,7 @@ public function enqueue_scripts() {
case 'development':
$scriptSrcUrl = 'https://checkout.dev.ledyer.com/bootstrap.js';
break;
default:
default:
$scriptSrcUrl = 'https://checkout.sandbox.ledyer.com/bootstrap.js';
break;
}
Expand Down Expand Up @@ -155,13 +163,6 @@ public function enqueue_scripts() {
true
);

wp_register_style(
'lco',
plugins_url( 'build/ledyer-checkout-for-woocommerce.css', LCO_WC_MAIN_FILE ),
array(),
filemtime( plugin_dir_path( LCO_WC_MAIN_FILE ) . ( 'build/ledyer-checkout-for-woocommerce.css' ) )
);

$email_exists = 'no';

if ( null !== WC()->customer && method_exists( WC()->customer, 'get_billing_email' ) && ! empty( WC()->customer->get_billing_email() ) ) {
Expand Down Expand Up @@ -220,18 +221,11 @@ public function enqueue_scripts() {
'no_shipping_message' => apply_filters( 'woocommerce_no_shipping_available_html', __( 'There are no shipping options available. Please ensure that your address has been entered correctly, or contact us if you need any help.', 'woocommerce' ) ),
);

if ( version_compare( WC_VERSION, '3.9', '>=' ) ) {
$checkout_localize_params['force_update'] = true;
}
wp_localize_script( 'lco', 'lco_params', $checkout_localize_params );
$checkout_localize_params['force_update'] = true;

wp_localize_script( 'lco', 'lco_params', $checkout_localize_params );
wp_enqueue_script( 'lco-iframe' );

wp_enqueue_script( 'lco' );

if ( ! $pay_for_order ) {
wp_enqueue_style( 'lco' );
}
}

/**
Expand Down Expand Up @@ -680,7 +674,7 @@ public function lom_allow_editing($order) {
if ( $order->has_status( array( 'completed', 'refunded', 'cancelled' ) ) ) {
return false;
}

return true;
}

Expand All @@ -692,3 +686,4 @@ public function lom_order_placed_with_ledyer($payment_method) {
}
}
}

0 comments on commit 5c288d0

Please sign in to comment.