• Resolved svr101

    (@svr101)


    Hello,

    I’m trying to apply a free shipping coupon to an order through the REST API. The applied coupon appears at the order page, but does nothing.

    I have free shipping enabled (amount OR coupon) in all shipping zones (for testing purposes), I followed the guide to create a free shipping coupon.

    How I can make the free shipping coupons work?

    my system report:

    
    ### WordPress Environment ###
    
    WordPress address (URL): https://api.elischer-r.hu
    Site address (URL): https://api.elischer-r.hu
    WC Version: 5.9.0
    REST API Version: ? 5.9.0
    WC Blocks Version: ? 6.1.0
    Action Scheduler Version: ? 3.3.0
    WC Admin Version: ? 2.8.0
    Log Directory Writable: ?
    WP Version: 5.8.2
    WP Multisite: –
    WP Memory Limit: 256 MB
    WP Debug Mode: –
    WP Cron: ?
    Language: hu_HU
    External object cache: –
    
    ### Server Environment ###
    
    Server Info: Apache
    PHP Version: 7.4.26
    PHP Post Max Size: 256 MB
    PHP Time Limit: 300
    PHP Max Input Vars: 1000
    cURL Version: 7.71.0
    OpenSSL/1.1.1d
    
    SUHOSIN Installed: –
    MySQL Version: 5.5.5-10.3.31-MariaDB-cll-lve
    Max Upload Size: 256 MB
    Default Timezone is UTC: ?
    fsockopen/cURL: ?
    SoapClient: ?
    DOMDocument: ?
    GZip: ?
    Multibyte String: ?
    Remote Post: ?
    Remote Get: ?
    
    ### Database ###
    
    WC Database Version: 5.9.0
    WC Database Prefix: wp_
    Teljes adatbázis mérete: 18.98MB
    Adatbázis adatok mérete: 14.86MB
    Adatbázis index mérete: 4.12MB
    wp_woocommerce_sessions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    wp_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_woocommerce_order_itemmeta: Data: 0.08MB + Index: 0.09MB + Engine InnoDB
    wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_actionscheduler_actions: Data: 0.23MB + Index: 0.44MB + Engine InnoDB
    wp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_actionscheduler_logs: Data: 0.22MB + Index: 0.19MB + Engine InnoDB
    wp_aioseo_notifications: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    wp_aioseo_posts: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_cartflows_ca_cart_abandonment: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_cartflows_ca_email_history: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_cartflows_ca_email_templates: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_cartflows_ca_email_templates_meta: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_cocart_carts: Data: 0.20MB + Index: 0.02MB + Engine InnoDB
    wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_comments: Data: 0.06MB + Index: 0.09MB + Engine InnoDB
    wp_duplicator_packages: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_gla_budget_recommendations: Data: 0.22MB + Index: 0.14MB + Engine InnoDB
    wp_gla_merchant_issues: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_gla_shipping_rates: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_gla_shipping_times: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_mailchimp_carts: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_mailchimp_jobs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_mailpoet_custom_fields: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_mailpoet_dynamic_segment_filters: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_mailpoet_feature_flags: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_mailpoet_forms: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_mailpoet_log: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_mailpoet_mapping_to_external_entities: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_mailpoet_newsletters: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_mailpoet_newsletter_links: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    wp_mailpoet_newsletter_option: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_mailpoet_newsletter_option_fields: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_mailpoet_newsletter_posts: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_mailpoet_newsletter_segment: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_mailpoet_newsletter_templates: Data: 2.52MB + Index: 0.00MB + Engine InnoDB
    wp_mailpoet_scheduled_tasks: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_mailpoet_scheduled_task_subscribers: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_mailpoet_segments: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_mailpoet_sending_queues: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_mailpoet_settings: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_mailpoet_statistics_bounces: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_mailpoet_statistics_clicks: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    wp_mailpoet_statistics_forms: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_mailpoet_statistics_newsletters: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_mailpoet_statistics_opens: Data: 0.02MB + Index: 0.08MB + Engine InnoDB
    wp_mailpoet_statistics_unsubscribes: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    wp_mailpoet_statistics_woocommerce_purchases: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    wp_mailpoet_stats_notifications: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_mailpoet_subscribers: Data: 0.02MB + Index: 0.13MB + Engine InnoDB
    wp_mailpoet_subscriber_custom_field: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_mailpoet_subscriber_ips: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_mailpoet_subscriber_segment: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_mailpoet_user_agents: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_mailpoet_user_flags: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_options: Data: 2.11MB + Index: 0.14MB + Engine InnoDB
    wp_postmeta: Data: 2.47MB + Index: 0.64MB + Engine InnoDB
    wp_posts: Data: 1.44MB + Index: 0.22MB + Engine InnoDB
    wp_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_term_relationships: Data: 0.05MB + Index: 0.02MB + Engine InnoDB
    wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_usermeta: Data: 0.08MB + Index: 0.03MB + Engine InnoDB
    wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    wp_wc_admin_notes: Data: 0.06MB + Index: 0.00MB + Engine InnoDB
    wp_wc_admin_note_actions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wc_customer_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_wc_order_product_lookup: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    wp_wc_order_stats: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    wp_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_wc_product_meta_lookup: Data: 0.06MB + Index: 0.09MB + Engine InnoDB
    wp_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wpmailsmtp_debug_events: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wpmailsmtp_tasks_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wpml_mails: Data: 3.52MB + Index: 0.00MB + Engine InnoDB
    
    ### Post Type Counts ###
    
    attachment: 327
    mailpoet_page: 1
    page: 12
    post: 63
    product: 43
    product_variation: 247
    revision: 132
    shop_coupon: 3
    shop_order: 42
    
    ### Security ###
    
    Secure connection (HTTPS): ?
    Hide errors from visitors: ?
    
    ### Active Plugins (12) ###
    
    CoCart Lite: írta Sébastien Dumont – 3.0.14
    Klasszikus szerkeszt?: írta WordPress-k?zrem?k?d?k – 1.6.2
    Duplicator: írta Snap Creek – 1.4.3
    WooCommerce Számlázz.hu Integráció: írta Viszt Péter – 5.5.5
    Really Simple SSL: írta Really Simple Plugins – 5.2.0
    Simple-JWT-Login: írta Nicu Micle – 3.3.1
    WooCommerce Cart Abandonment Recovery: írta CartFlows Inc – 1.2.13
    WooCommerce PayPal Payments: írta WooCommerce – 1.6.1 (update to version 1.6.2 is available)
    WooCommerce: írta Automattic – 5.9.0
    WP Mail Logging: írta Wysija – 1.10.2
    WP Mail SMTP: írta WPForms – 3.2.1
    WP Multilang: írta Valentyn Riaboshtan – 2.4.1
    
    ### Inactive Plugins (2) ###
    
    Akismet Anti-Spam: írta Automattic – 4.2.1
    Mailchimp for WooCommerce: írta Mailchimp – 2.5.4
    
    ### Settings ###
    
    API Enabled: –
    Force SSL: –
    Currency: HUF (Ft)
    Currency Position: right_space
    Thousand Separator: 
    Decimal Separator: ,
    Number of Decimals: 0
    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 ###
    
    Webshop f?oldal: #9 - /en/shop/
    Kosár: #10 - /en/cart/
    Pénztár: #11 - /en/checkout/
    A fiókom: #12 - /en/my-account/
    általános Szerz?dési Feltételek: ? Az oldal nincs beállítva
    
    ### Theme ###
    
    Name: Twenty Twenty-One
    Version: 1.4
    Author URL: https://www.ads-software.com/
    Child Theme: ? – Amennyiben a WooCommerce-t egy olyan szül?sablonban módosítunk
    amelyet nem saját magunk készítettünk
    akkor javasoljuk a származtatott sablon használatát. Hogyan készítsünk származtatott sablonokat
    
    WooCommerce Support: ?
    
    ### Templates ###
    
    Overrides: twentytwentyone/woocommerce/emails/customer-processing-order.php
    
    ### Számlázz.hu ###
    
    útvonal: /home/elischer/api/wp-content/uploads/wc_szamlazz
    Fizetési módok: Array
    (
        [bacs] => Array
            (
                [deadline] => 
                [complete] => 
                [proform] => 
                [deposit] => 
                [name] => 
                [auto_disabled] => 
            )
    
        [barion] => Array
            (
                [deadline] => 
                [complete] => 
                [proform] => 
                [deposit] => 
                [name] => 
                [auto_disabled] => 
            )
    
    )
    
    ### WooCommerce PayPal Payments ###
    
    Onboarded: Yes
    Shop country code: HU
    PayPal card processing available in country: No
    Pay Later messaging available in country: No
    Vault enabled: No
    
    ### Action Scheduler ###
    
    Teljesítve: 818
    Oldest: 2021-11-04 20:08:40 +0000
    Newest: 2021-12-05 19:33:39 +0000
    
    Függ?ben: 1
    Oldest: 2021-12-06 19:07:14 +0000
    Newest: 2021-12-06 19:07:14 +0000
    
    ### CoCart ###
    
    Version: 3.0.14
    Database Version: 3.0.16
    Install Date: 2021-09-18
    Carts in Session: 42
    Carts Active: 42 out of 42 in session.
    Carts Expiring Soon: 0 out of 42 in session.
    Carts Expired: 0 out of 42 in session.
    Carts Source (by CoCart): 0
    Carts Source (by Web): 1
    Carts Source (by Other): 41
    
    ### Status report information ###
    
    Generated at: 2021-12-05 19:39:07 +00:00
    
Viewing 11 replies - 1 through 11 (of 11 total)
  • Rynald0s

    (@rynald0s)

    Automattic Happiness Engineer

    Hi @svr101!

    It isn’t immediately clear what your code looks like, but are you adding the ‘coupon_lines’ into the data array?

    You’ll find an example here: https://stackoverflow.com/questions/47028444/woocommerce-orders-rest-api-add-a-coupon-code

    Cheers!

    Thread Starter svr101

    (@svr101)

    Hey,

    Yes, I’m adding to the coupon_lines array. It does appear when I navigate to the orders details page. I can use fixed discount coupons.

    I followed this guide: https://woocommerce.com/document/free-shipping/

    Thanks!

    Hi @svr101,

    It sounds like you were able to get that figured out – I’ll go ahead and mark this topic as resolved.

    Let us know if you need any further assistance! ??

    Thread Starter svr101

    (@svr101)

    Hi,

    No I didn’t. I just clarified some details that @rynald0s asked.

    Thread Starter svr101

    (@svr101)

    So do you guys have any idea what causes this issue?

    Hi @svr101,

    Can you include a sample of the REST API request that you’re using to do this? That would help us troubleshoot it. You can add it at https://gist.github.com/ and then share the URL to it here if you’d like to.

    Thanks!

    Thread Starter svr101

    (@svr101)

    Sure, I will do it today.

    Sounds good! Let us know how it goes.

    Thread Starter svr101

    (@svr101)

    Hello,

    So. I’m using the PUT endpoint https://mysite.com/wp-json/wc/v3/orders/1308

    with this payload:

    {"coupon_lines":[{"code":"YE58HUW4"}],"id":1308}

    The coupon has the free shipping enabled.
    The free shipping is enabled for the shipping zone. (The enabled region is Hungary)

    I’m posting the shipping and billing address like this:

    {
      "id": 1308,
      "billing": {
        "first_name": "fname",
        "last_name": "last name",
        "address_1": "teszt 1",
        "address_2": "",
        "city": "Budapest",
        "state": "BU",
        "postcode": "1016",
        "country": "HU",
        "email": "valid email",
        "phone": "phone number"
      },
      "shipping": {
        "first_name": "fname",
        "last_name": "lastname",
        "address_1": "teszt 1",
        "address_2": "",
        "city": "Budapest",
        "state": "BU",
        "postcode": "1016",
        "country": "HU"
      }
    }
    • This reply was modified 2 years, 11 months ago by svr101.

    Am I correct in assuming that you expect that API call to remove the shipping cost and/or change the shipping method on the order to free shipping? If I’ve got that right, I’m afraid that’s not going to perform according to your expectation. If you wish to edit the shipping amount or the shipping method, you would need to send an appropriate request to do that.

    Hi,

    We haven’t heard back from you in a while, so I’m marking this thread as resolved – we’ll be here if and/or when you are ready to continue.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Rest API + free shipping coupon’ is closed to new replies.