WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
A random post gets added to the cart (4 posts)

  1. ssj_costy
    Member
    Posted 1 year ago #

    Hi, I have a problem: sometimes when I add a product to the cart, a random PAGE or post gets added instead of the product. How can that be happening?

    Best regards,
    Costin

    http://wordpress.org/extend/plugins/woocommerce/

  2. jameskoster
    Member
    Plugin Author

    Posted 1 year ago #

    Hey,

    Not sure :-) Unless somehow you have some duplicate post IDs in your DB. Try trashing and republishing the affected posts / products.

  3. ssj_costy
    Member
    Posted 1 year ago #

    It doesn't solve the problem. I have no duplicate IDs, but sometimes other posts still get added.
    This is a print_r of $woocommerce->cart->get_cart() right now. You can see I have 2 posts and a product in the cart...

    [27-May-2013 01:53:03] get_cart: Array
    (
        [6195f47dcff14b8f242aa333cdb2703e] => Array
            (
                [product_id] => 4143
                [variation_id] =>
                [variation] =>
                [quantity] => 1
                [data] => WC_Product_Simple Object
                    (
                        [id] => 4143
                        [post] => WP_Post Object
                            (
                                [ID] => 4143
                                [post_author] => 3
                                [post_date] => 2013-01-18 02:31:47
                                [post_date_gmt] => 2013-01-18 01:31:47
                                [post_content] =>
                                [post_title] => Carpaccio
                                [post_excerpt] =>
                                [post_status] => inherit
                                [comment_status] => open
                                [ping_status] => closed
                                [post_password] =>
                                [post_name] => 1435-revision-3
                                [to_ping] =>
                                [pinged] =>
                                [post_modified] => 2013-01-18 02:31:47
                                [post_modified_gmt] => 2013-01-18 01:31:47
                                [post_content_filtered] =>
                                [post_parent] => 1435
                                [guid] => http://wp.a-h-b.dk/1435-revision-3/
                                [menu_order] => 0
                                [post_type] => revision
                                [post_mime_type] =>
                                [comment_count] => 0
                                [filter] => raw
                            )
    
                        [product_type] => simple
                    )
    
                [line_total] => 0
                [line_tax] => 0
                [line_subtotal] => 0
                [line_subtotal_tax] => 0
            )
    
        [1543843a4723ed2ab08e18053ae6dc5b] => Array
            (
                [product_id] => 395
                [variation_id] =>
                [variation] =>
                [quantity] => 2
                [data] => WC_Product_Simple Object
                    (
                        [id] => 395
                        [post] => WP_Post Object
                            (
                                [ID] => 395
                                [post_author] => 3
                                [post_date] => 2012-11-08 21:37:08
                                [post_date_gmt] => 2012-11-08 20:37:08
                                [post_content] => <p>Kan indløses i Bryggeriet og på A Hereford Beefstouw-restauranterne. (Dog ikke i Australien)</p>
                                [post_title] => 500kr Gavemønt
                                [post_excerpt] => <p>Designet af Janis Strupulis. Mønterne et individuelt nummerede.</p>
                                [post_status] => publish
                                [comment_status] => closed
                                [ping_status] => closed
                                [post_password] =>
                                [post_name] => messing
                                [to_ping] =>
                                [pinged] =>
                                [post_modified] => 2013-05-16 08:58:03
                                [post_modified_gmt] => 2013-05-16 07:58:03
                                [post_content_filtered] =>
                                [post_parent] => 0
                                [guid] => http://wp.a-h-b.dk/?post_type=product&p=395
                                [menu_order] => 1
                                [post_type] => product
                                [post_mime_type] =>
                                [comment_count] => 0
                                [filter] => raw
                            )
    
                        [product_type] => simple
                    )
    
                [line_total] => 1000
                [line_tax] => 0
                [line_subtotal] => 1000
                [line_subtotal_tax] => 0
            )
    
        [d80b7040b773199015de6d3b4293c8ff] => Array
            (
                [product_id] => 4956
                [variation_id] =>
                [variation] =>
                [quantity] => 1
                [data] => WC_Product_Simple Object
                    (
                        [id] => 4956
                        [post] => WP_Post Object
                            (
                                [ID] => 4956
                                [post_author] => 3
                                [post_date] => 2013-04-08 09:40:31
                                [post_date_gmt] => 2013-04-08 08:40:31
                                [post_content] =>
                                [post_title] => Test
                                [post_excerpt] =>
                                [post_status] => publish
                                [comment_status] => open
                                [ping_status] => closed
                                [post_password] =>
                                [post_name] => test
                                [to_ping] =>
                                [pinged] =>
                                [post_modified] => 2013-04-08 09:40:31
                                [post_modified_gmt] => 2013-04-08 08:40:31
                                [post_content_filtered] =>
                                [post_parent] => 0
                                [guid] => http://wp.a-h-b.dk/?post_type=product&p=4956
                                [menu_order] => 3
                                [post_type] => product
                                [post_mime_type] =>
                                [comment_count] => 0
                                [filter] => raw
                            )
    
                        [product_type] => simple
                    )
    
                [line_total] => 80
                [line_tax] => 20
                [line_subtotal] => 80
                [line_subtotal_tax] => 20
            )
    
    )


    [Please use the code buttons]

  4. ssj_costy
    Member
    Posted 1 year ago #

    I have figured out what the problem is, but I don't know how to solve it.
    I have a multi-site with 3 sites, and WooCommerce is installed on each site.

    WooCommerce saves a user's cart in the wp_usermeta table, which is global for all sites. If on site A I add the product with id X, on site B I have a different type of post with id X, so WooCommerce looks in the common usermeta table and loads that post.

    Is there any way to fix this problem? I really need the shop on all sites.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic