Forum Replies Created

Viewing 15 replies - 1 through 15 (of 49 total)
  • Thread Starter vato

    (@vatanbytyqi)

    So the issue here is that the order needs to be completed from My Orders page, thus it’s not a bug in WooCommerce but a customization. Here is how to solve it.

    The code that causes the problem is located here:

    
    # includes/wc-class-order.php
    
            /**
    	 * Checks if an order needs payment, based on status and order total.
    	 *
    	 * @return bool
    	 */
    	public function needs_payment() {
    		$valid_order_statuses = apply_filters( 'woocommerce_valid_order_statuses_for_payment', array( 'pending', 'failed' ), $this );
    		return apply_filters( 'woocommerce_order_needs_payment', ( $this->has_status( $valid_order_statuses ) && $this->get_total() > 0 ), $this, $valid_order_statuses );
    	}
    

    More specifically this causes the problem $this->get_total() > 0

    So to override this filter, add this to your functions.php

    
    //Allow pay for order when the total price is $0.00 in frontend
    function check_order_payment($th, $order, $valid_order_statuses) {
      return $order->has_status( $valid_order_statuses );
    }
    remove_filter('woocommerce_order_needs_payment', WC_Order);
    add_filter( 'woocommerce_order_needs_payment', 'check_order_payment', 10, 3 );
    
    Thread Starter vato

    (@vatanbytyqi)

    @serafinnyc could you verify the same behaviour on your site?

    Thread Starter vato

    (@vatanbytyqi)

    Ok thank you for the information. However I’m able to apply the coupon through backend without any problem. I haven’t digged deeper into the solution but shouldn’t it be a small fix since it’s already supported through backend?

    Thread Starter vato

    (@vatanbytyqi)

    Ok @serafinnyc and @riaanknoetze let me clarify

    What I’m trying to achieve
    1. Disable cart completly [no problem]
    2. Generate orders from admin backend instead [no problem]
    3. Let customers pay for these orders [no problem]
    4. Let customers apply coupons on these orders [problem, see description]

    What my problem is
    When customers view their orders and try to apply a coupon it doesn’t get applied on the order.
    I have modified my template to include the code which applies a coupon with the following modification.

    
    <?php wc_get_template( ‘checkout/form-coupon.php’ ); ?>
    

    How to reproduce
    1. Login with the credentials I provided
    2. Go to My Account -> Orders
    3. Press “Pay” on order #218
    4. Try to apply coupon1

    Thanks in advance!

    Thread Starter vato

    (@vatanbytyqi)

    @serafinnyc you are involved in my other post as well. I have the link and credentials there to test, it’s the same site ??

    Thread Starter vato

    (@vatanbytyqi)

    Sorry I mixed up the responses from another post I have which is related to this.

    As I mentiond in my intial post, I’ve modified the form-pay.php to include the template form-coupon.php. This applies a coupon but not on the order itself but on the cart. If I apply the coupon from backend then it becomes correct.

    Thread Starter vato

    (@vatanbytyqi)

    Here is an image that shows my issue, payment isn’t possible from orders page

    View post on imgur.com

    Thread Starter vato

    (@vatanbytyqi)

    wrong post…

    Thread Starter vato

    (@vatanbytyqi)

    @serafinnyc Yes it’s possible from cart page but not from orders page. If you login with the test account I provided you then you can see that you aren’t able apply the coupon successfully on the order. It says it’s applied but the total value hasn’t changed. If I apply the coupon from backend then total value is changed.
    https://<domain>/my-account/orders

    • This reply was modified 5 years, 10 months ago by vato.
    Thread Starter vato

    (@vatanbytyqi)

    Hi @riaanknoetze and @serafinnyc

    I’ve created a temporary account
    name: testwoo
    pass: mywoopassword

    https://bit.ly/2VTcgbj

    Go to /wp-admin to sign in and then you will see all your orders. There are two orders

    1. Free product
    2. Not free product

    Use the coupon coupon1 to get 50% discount

    Thank you for your help!

    Thread Starter vato

    (@vatanbytyqi)

    Lucky you ?? What kind of payment methods do you have?

    Thread Starter vato

    (@vatanbytyqi)

    Can you make an order on your backend and then go to frontend and try to complete it? Instead of using the cart?

    Thread Starter vato

    (@vatanbytyqi)

    Yes ?? It’s a proper URL and the downloads work ??

    Thread Starter vato

    (@vatanbytyqi)

    Here is the system report

    
    ### WordPress Environment ###
    
    WordPress address (URL): https://XXXX
    Site address (URL): https://XXXX
    WC Version: 3.6.3
    Log Directory Writable: ?
    WP Version: 5.2
    WP Multisite: –
    WP Memory Limit: 256 MB
    WP Debug Mode: –
    WP Cron: ?
    Language: en_US
    External object cache: –
    
    ### Server Environment ###
    
    Server Info: Apache/2.4.10 (Debian)
    PHP Version: 7.0.32-1~dotdeb+8.1 - We recommend using PHP version 7.2 or above for greater performance and security. How to update your PHP version
    PHP Post Max Size: 10 MB
    PHP Time Limit: 60
    PHP Max Input Vars: 2500
    cURL Version: 7.38.0
    OpenSSL/1.0.1t
    
    SUHOSIN Installed: –
    MySQL Version: ? 5.5.62-0+deb8u1 - We recommend a minimum MySQL version of 5.6. See: WordPress requirements
    Max Upload Size: 10 MB
    Default Timezone is UTC: ?
    fsockopen/cURL: ?
    SoapClient: ?
    DOMDocument: ?
    GZip: ?
    Multibyte String: ?
    Remote Post: ?
    Remote Get: ?
    
    ### Database ###
    
    WC Database Version: 3.6.3
    WC Database Prefix: wp_
    MaxMind GeoIP Database: ?
    Total Database Size: 8.67MB
    Database Data Size: 5.59MB
    Database Index Size: 3.08MB
    wp_woocommerce_sessions: Data: 0.02MB + Index: 0.02MB
    wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB
    wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB
    wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB
    wp_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB
    wp_woocommerce_order_itemmeta: Data: 0.05MB + Index: 0.03MB
    wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB
    wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB
    wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB
    wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB
    wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB
    wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB
    wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB
    wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB
    wp_commentmeta: Data: 0.02MB + Index: 0.03MB
    wp_comments: Data: 0.02MB + Index: 0.09MB
    wp_failed_jobs: Data: 0.02MB + Index: 0.00MB
    wp_links: Data: 0.02MB + Index: 0.02MB
    wp_mailchimp_carts: Data: 0.02MB + Index: 0.00MB
    wp_media_folders_lists: Data: 0.02MB + Index: 0.00MB
    wp_media_folder_file_relationship: Data: 0.02MB + Index: 0.00MB
    wp_mgmlp_folders: Data: 0.00MB + Index: 0.00MB
    wp_mondido_customers: Data: 0.02MB + Index: 0.02MB
    wp_options: Data: 2.08MB + Index: 0.08MB
    wp_pantheon_sessions: Data: 2.52MB + Index: 1.86MB
    wp_postmeta: Data: 0.17MB + Index: 0.17MB
    wp_posts: Data: 0.08MB + Index: 0.06MB
    wp_queue: Data: 0.02MB + Index: 0.00MB
    wp_termmeta: Data: 0.02MB + Index: 0.03MB
    wp_terms: Data: 0.02MB + Index: 0.03MB
    wp_term_relationships: Data: 0.02MB + Index: 0.02MB
    wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB
    wp_usermeta: Data: 0.02MB + Index: 0.03MB
    wp_users: Data: 0.02MB + Index: 0.05MB
    wp_wc_download_log: Data: 0.02MB + Index: 0.03MB
    wp_wc_product_meta_lookup: Data: 0.02MB + Index: 0.09MB
    wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB
    wp_wsluserscontacts: Data: 0.02MB + Index: 0.02MB
    wp_wslusersprofiles: Data: 0.02MB + Index: 0.03MB
    wp_wslwatchdog: Data: 0.03MB + Index: 0.00MB
    
    ### Post Type Counts ###
    
    attachment: 13
    customize_changeset: 9
    mgmlp_media_folder: 9
    nav_menu_item: 2
    page: 5
    product: 8
    revision: 11
    scheduled-action: 15
    shop_coupon: 3
    shop_order: 29
    
    ### Security ###
    
    Secure connection (HTTPS): ?
    Hide errors from visitors: ?
    
    ### Active Plugins (12) ###
    
    Native PHP Sessions for WordPress: by Pantheon – 0.7.0
    JSON Basic Authentication: by WordPress API Team – 0.1
    WooCommerce Mondido Payments Gateway: by Mondido – 4.3.1 – Not tested with the active version of WooCommerce
    Breeze: by Cloudways – 1.0.10
    Jetpack by WordPress.com: by Automattic – 7.3.1
    Mailchimp for WooCommerce: by Mailchimp – 2.1.16 – Not tested with the active version of WooCommerce
    Organize Media Library by Folders: by Katsushi Kawamori – 6.44
    WooCommerce Blocks: by Automattic – 2.1.0
    WooCommerce Google Analytics Integration: by WooCommerce – 1.4.9
    WooCommerce Services: by Automattic – 1.20.0
    WooCommerce: by Automattic – 3.6.3
    WordPress Social Login for Struktanalys: by Miled
    Vatan – 5.1.0-Struktanalys
    
    ### Inactive Plugins (4) ###
    
    Akismet Anti-Spam: by Automattic – 4.1.2
    Hello Dolly: by Matt Mullenweg – 1.7.1
    Klarna Checkout for WooCommerce: by Krokedil – 1.8.4 – Not tested with the active version of WooCommerce
    Klarna Order Management for WooCommerce: by klarna
    krokedil – 1.2.5 – Not tested with the active version of WooCommerce
    
    ### Settings ###
    
    API Enabled: ?
    Force SSL: –
    Currency: SEK (kr)
    Currency Position: right
    Thousand Separator: 
    Decimal Separator: ,
    Number of Decimals: 2
    Taxonomies: Product Types: external (external)
    grouped (grouped)
    simple (simple)
    variable (variable)
    
    Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)
    exclude-from-search (exclude-from-search)
    featured (featured)
    outofstock (outofstock)
    rated-1 (rated-1)
    rated-2 (rated-2)
    rated-3 (rated-3)
    rated-4 (rated-4)
    rated-5 (rated-5)
    
    Connected to WooCommerce.com: –
    
    ### WC Pages ###
    
    Shop base: #7 - /
    Cart: #8 - /cart
    Checkout: #9 - /checkout
    My account: #10 - /my-account
    Terms and conditions: #3 - /privacy-policy
    
    ### Theme ###
    
    Name: Storefront Child Theme
    Version: 1.0.1
    Author URL: https://memoria.se
    Child Theme: ?
    Parent Theme Name: Storefront
    Parent Theme Version: 2.4.5 – 2.5.0 is available
    Parent Theme Author URL: https://woocommerce.com/
    WooCommerce Support: ?
    
    ### Templates ###
    
    Overrides: storefront-child/woocommerce/auth/form-login.php
    storefront-child/woocommerce/checkout/form-login.php
    storefront-child/woocommerce/checkout/form-pay.php
    storefront-child/woocommerce/global/form-login.php version 3.3.0 is out of date. The core version is 3.6.0
    storefront-child/woocommerce/myaccount/form-login.php version 3.5.0 is out of date. The core version is 3.6.0
    
    Outdated Templates: ?
    					
    					
    						Learn how to update
    
    ### Action Scheduler ###
    
    Complete: 15
    Oldest: 2019-05-19 16:00:40 +0200
    Newest: 2019-05-19 16:01:54 +0200
    
    Pending: 0
    Oldest: –
    Newest: –
    
    Canceled: 0
    Oldest: –
    Newest: –
    
    In-progress: 0
    Oldest: –
    Newest: –
    
    Failed: 0
    Oldest: –
    Newest: –
    
    
    Thread Starter vato

    (@vatanbytyqi)

Viewing 15 replies - 1 through 15 (of 49 total)