Skip to content

Commit

Permalink
fix(led-544): additional fields appear twice (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
timjackleus authored Dec 15, 2023
1 parent 6526dfa commit 58eda9b
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 41 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# ledyer-checkout-for-woocommerce

Ledyer checkout plugin for WooCommerce

## Local dev environment
Expand All @@ -20,6 +21,7 @@ You can add a breakpoint in `lco-functions.php` -> `lco_create_or_update_order`

If you are missing data i woocommerce, make sure you have set the following:

* If you are logged in, your use must be set to country = sweden. User -> Edit profile -> Country/Region -> Sweden
* Make sure that the Woocommerce shop is configured to target Sweden. Woocommerce -> Settings -> General -> Country/Region -> Sweden
* Make sure that the Woocommerce shop is configured to use Swedish krona. Woocommerce -> Settings -> General -> Currency -> Swedish krona (kr)
- If you are logged in, your use must be set to country = sweden. User -> Edit profile -> Country/Region -> Sweden
- Make sure that the Woocommerce shop is configured to target Sweden. Woocommerce -> Settings -> General -> Country/Region -> Sweden
- Make sure that the Woocommerce shop is configured to use Swedish krona. Woocommerce -> Settings -> General -> Currency -> Swedish krona (kr)
- Make sure to enter a terms url in Ledyer checkout plugin settings.
6 changes: 0 additions & 6 deletions assets/scss/ledyer-checkout-for-woocommerce.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@
width: 100%;
}

.woocommerce-billing-fields,
.woocommerce-shipping-fields,
.woocommerce-terms-and-conditions-wrapper {
display: none;
}

#lco-iframe {
display: flex;
justify-content: center;
Expand Down
2 changes: 1 addition & 1 deletion build/ledyer-checkout-for-woocommerce.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-polyfill'), 'version' => '1a2bf5df7229fa3f1127d147cd1362c4');
<?php return array('dependencies' => array('wp-polyfill'), 'version' => '2b52588deee13ae5704c06dae8bd9a99');
2 changes: 1 addition & 1 deletion build/ledyer-checkout-for-woocommerce.css
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#lco-wrapper{display:flex;flex-direction:column;align-items:center}#lco-wrapper #lco-order-review,#lco-wrapper #lco-iframe{width:100%}#lco-wrapper .woocommerce-billing-fields,#lco-wrapper .woocommerce-shipping-fields,#lco-wrapper .woocommerce-terms-and-conditions-wrapper{display:none}#lco-wrapper #lco-iframe{display:flex;justify-content:center}
#lco-wrapper{display:flex;flex-direction:column;align-items:center}#lco-wrapper #lco-order-review,#lco-wrapper #lco-iframe{width:100%}#lco-wrapper #lco-iframe{display:flex;justify-content:center}
2 changes: 1 addition & 1 deletion classes/class-ledyer-templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function filters() {
// Unrequire WooCommerce Shipping State field.
\add_filter( 'woocommerce_shipping_fields', array( $this, 'unrequire_wc_shipping_state_field' ) );
// Chage admin shipping fields in edit order admin panel
\add_filter('woocommerce_admin_shipping_fields', array($this, 'change_admin_shipping_fields'), 10, 1);
\add_filter('woocommerce_admin_shipping_fields', array($this, 'change_admin_shipping_fields'), 10, 1);
}

public function actions() {
Expand Down
9 changes: 5 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
version: '3.1'
version: "3.1"
services:
db:
image: mariadb:latest
image: mariadb:10.4
restart: on-failure
ports:
- 13306:3306
environment:
MYSQL_DATABASE: testdb
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
MYSQL_RANDOM_ROOT_PASSWORD: '1'
MYSQL_RANDOM_ROOT_PASSWORD: "1"
volumes:
- dbdata:/var/lib/mysql

Expand Down Expand Up @@ -74,7 +74,8 @@ services:
wp core install --url=http://localhost:8181 --title="Ledyer Checkout" --admin_user=admin --admin_password=password [email protected] --path=/var/www/html --skip-email;
wp rewrite structure /%postname%/;
wp plugin install wordpress-importer --activate;
wp plugin install woocommerce --activate;
wp plugin install wp-rollback --activate;
wp plugin install woocommerce --version=8.2.2 --activate;
wp theme install storefront --activate;
wp wc tool run install_pages --user=1;
wp import wp-content/plugins/woocommerce/sample-data/sample_products.xml --authors=create;
Expand Down
57 changes: 32 additions & 25 deletions templates/ledyer-checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,38 @@
?>

<form name="checkout" class="checkout woocommerce-checkout">
<?php do_action( 'lco_wc_before_wrapper' ); ?>
<div id="lco-wrapper">
<div id="lco-order-review">
<?php do_action( 'lco_wc_before_order_review' ); ?>
<?php
if ( ! isset( $settings['show_subtotal_detail'] ) || in_array( $settings['show_subtotal_detail'], array( 'woo', 'both' ), true ) ) {
woocommerce_order_review();
WC()->checkout()->checkout_form_billing();
WC()->checkout()->checkout_form_shipping();
wc_get_template( 'checkout/terms.php' );
}
?>
<?php do_action( 'lco_wc_after_order_review' ); ?>
</div>

<div id="lco-iframe">
<?php do_action( 'lco_wc_before_snippet' ); ?>
<?php $ledyer_order = lco_create_or_update_order(); ?>

<?php if( false === $ledyer_order ) wc_ledyer_cart_redirect(); ?>

<?php do_action( 'lco_wc_after_snippet' ); ?>
</div>
</div>
<?php do_action( 'lco_wc_after_wrapper' ); ?>
<?php do_action( 'lco_wc_before_wrapper' ); ?>

<div id="lco-wrapper">
<div id="lco-order-review">
<?php
do_action( 'lco_wc_before_order_review' );

// Show order review based on settings
if ( ! isset( $settings['show_subtotal_detail'] ) || in_array( $settings['show_subtotal_detail'], ['woo', 'both'], true ) ) :
woocommerce_order_review();
endif;

do_action( 'lco_wc_after_order_review' );
?>
</div>

<div id="lco-iframe">
<?php
do_action( 'lco_wc_before_snippet' );

// Create or update the order and handle redirection
$ledyer_order = lco_create_or_update_order();
if ( false === $ledyer_order ) :
wc_ledyer_cart_redirect();
endif;

do_action( 'lco_wc_after_snippet' );
?>
</div>
</div>

<?php do_action( 'lco_wc_after_wrapper' ); ?>
</form>

<?php do_action( 'woocommerce_after_checkout_form', WC()->checkout() ); ?>

0 comments on commit 58eda9b

Please sign in to comment.