Support » Plugin: WooCommerce » 3.0.3 – Cart URL Redirecting to /my-account/cart

  • Resolved waylayde

    (@waylayde)


    I found this bit of code that will allow for reordering the “My Account” dashboard links. I also added in a link to the “Cart” page. This was working properly in 3.0.1, the URL would go to /cart/, however after updating to 3.0.3 the URL redirects to /my-account/cart/ but the page does not change, it just stays on the main My Account page.

    All other links still work, it’s just the cart URL that broke. I tried to make My Account the parent page of the Cart page so that the URL would match (/my-account/cart) but that did not work, it was the same effect as the redirect.

    I reverted back to 3.0.1 (files and database) and it’s working again so I can confirm that it was the update that did it.

    I know the other My Account endpoints are appended to the /my-account/ from the WooCommerce documentation so I’m just wondering if the cart page has now been added to that list.

    function wpb_woo_my_account_order() {
     $myorder = array(
     'dashboard' => __( 'My Account', 'woocommerce' ),
     'directory_dashboard' => __( 'Listing Dashboard', 'woocommerce' ), 
     'orders' => __( 'Pending / Paid Listing Orders', 'woocommerce' ),
     <strong>'cart' => __( 'Listings Awaiting Payment', 'woocommerce' ),</strong>
     'edit-account' => __( 'Change My Details', 'woocommerce' ),
     'customer-logout' => __( 'Logout', 'woocommerce' ),
     );
     return $myorder;
    }
    add_filter ( 'woocommerce_account_menu_items', 'wpb_woo_my_account_order' );

    The site is a barebones demo testing site running TwentySixteen Theme.

    
    ### WordPress Environment ###
    
    Home URL: https://www.waylaydesign.com/wpdemo
    Site URL: https://www.waylaydesign.com/wpdemo
    WC Version: 3.0.1
    Log Directory Writable: ✔
    WP Version: 4.7.3
    WP Multisite: –
    WP Memory Limit: 256 MB
    WP Debug Mode: –
    WP Cron: ✔
    Language: en_US
    
    ### Server Environment ###
    
    Server Info: Apache
    PHP Version: ❌ 5.5.25 - We recommend a minimum PHP version of 5.6. See: How to update your PHP version
    PHP Post Max Size: 32 MB
    PHP Time Limit: 30
    PHP Max Input Vars: 1000
    cURL Version: 7.38.0
    OpenSSL/1.0.1e
    
    SUHOSIN Installed: –
    MySQL Version: ❌ 5.5.52 - We recommend a minimum MySQL version of 5.6. See: WordPress requirements
    Max Upload Size: 32 MB
    Default Timezone is UTC: ✔
    fsockopen/cURL: ✔
    SoapClient: ✔
    DOMDocument: ✔
    GZip: ✔
    Multibyte String: ✔
    Remote Post: ✔
    Remote Get: ✔
    
    ### Database ###
    
    WC Database Version: 3.0.1
    WC Database Prefix: wp_
    woocommerce_sessions: ✔
    woocommerce_api_keys: ✔
    woocommerce_attribute_taxonomies: ✔
    woocommerce_downloadable_product_permissions: ✔
    woocommerce_order_items: ✔
    woocommerce_order_itemmeta: ✔
    woocommerce_tax_rates: ✔
    woocommerce_tax_rate_locations: ✔
    woocommerce_shipping_zones: ✔
    woocommerce_shipping_zone_locations: ✔
    woocommerce_shipping_zone_methods: ✔
    woocommerce_payment_tokens: ✔
    woocommerce_payment_tokenmeta: ✔
    MaxMind GeoIP Database: ✔
    
    ### Security ###
    
    Secure connection (HTTPS): ✔
    Hide errors from visitors: ✔
    
    ### Active Plugins (7) ###
    
    Advanced Custom Fields: by Elliot Condon – 4.4.11
    Password Protected: by Ben Huson – 2.0.3
    Post State Tags: by BRANDbrilliance – 1.1.6
    CyberSource - WooCommerce Payment Gateway: by oragon – 1.6.3
    Web 2.0 Directory plugin: by salephpscripts.com – 1.13.5
    WooCommerce: by Automattic – 3.0.1 – 3.0.3 is available
    WooCommerce Helper: by WooCommerce – 1.7.2 – Network enabled
    
    ### Settings ###
    
    API Enabled: ✔
    Force SSL: –
    Currency: USD ($)
    Currency Position: left
    Thousand Separator: ,
    Decimal Separator: .
    Number of Decimals: 2
    Taxonomies: Product Types: external (external)
    grouped (grouped)
    listing_single (listing_single)
    listings_package (listings_package)
    simple (simple)
    variable (variable)
    
    ### WC Pages ###
    
    Shop base: #324 - /shop/
    Cart: #325 - /cart/
    Checkout: #326 - /checkout/
    My account: #327 - /my-account/
    
    ### Theme ###
    
    Name: Twenty Sixteen
    Version: 1.3
    Author URL: https://wordpress.org/
    Child Theme: ❌ – If you're modifying WooCommerce on a parent theme you didn't build personally
    then we recommend using a child theme. See: How to create a child theme
    
    WooCommerce Support: ✔
    
    ### Templates ###
    
    Overrides: twentysixteen/woocommerce/checkout/thankyou.php
    twentysixteen/woocommerce/myaccount/dashboard.php
    twentysixteen/woocommerce/myaccount/form-login.php
    twentysixteen/woocommerce/myaccount/my-account.php
    twentysixteen/woocommerce/myaccount/orders.php
    
    

    Any info appreciated!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    Paste your code on https://gist.github.com/ so it’s not formatted wrongly.

    “cart” is not a standard my-account endpoint either, so unless you have a plugin adding that endpoint, it won’t do anything.

    Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    Ah I missed this:

    > I tried to make My Account the parent page of the Cart page so that the URL would match (/my-account/cart) but that did not work, it was the same effect as the redirect.

    Thats not supported. Pages and endpoints will conflict. Cart page needs to be separate to my-account page.

    Thread Starter waylayde

    (@waylayde)

    Thanks for the info Mike. I created the gist here. It includes the full code snippet added to my functions.php file to set navigation links in the My Account menu. Original code I got here.

    If I can send you account login credentials I’d be glad to show you the working version of this as it is now along with admin credentials if you want to do the WooCommerce update and see that it breaks (starts redirecting to the my-account URL) right after. I have a full backup of everything so I can restore it later.

    I should note that when reverting back I replaced just the plugin files only at first and confirmed that I was running 3.0.1 but the problem still persisted. It was only after I restored the database that the cart link started working again. ¯\_(ツ)_/¯

    Thanks again for your time and input.

    Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    In your snippet, there is no handler for 'cart' => __( 'Listings Awaiting Payment', 'woocommerce' ),.

    As I mentioned, URLs will conflict (pages and endpoints). WordPress simply doesn’t know what to show and it can lead to seemingly random handling. I’d ditch this and keep cart top level.

    Thread Starter waylayde

    (@waylayde)

    Thanks for the info Mike!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘3.0.3 – Cart URL Redirecting to /my-account/cart’ is closed to new replies.