Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › Function to check eStore cart status
- This topic has 8 replies, 3 voices, and was last updated 8 years, 11 months ago by
grhapa.
-
AuthorPosts
-
April 14, 2017 at 2:23 am #14186
grhapa
MemberHello,
I am looking for correct the function to check whether cart is empty or not. I am planning to use that function for menu visibility check.
I tried eStore_cart_when_not_empty()function but it’s not working.
For example, I used wp_emember_is_member_logged_in() function for visibility check and it works fine.
April 14, 2017 at 1:05 pm #75491wzp
ModeratorThat PHP function will DISPLAY or RENDER the cart, if it is not empty.
It is a “void” type function that does not return a (TRUE | FALSE) value, related to the “emptiness” of the cart.
April 14, 2017 at 11:31 pm #75492admin
KeymasterYou can use the following function to see if the cart is empty or nor:
if (digi_cart_not_empty()) {
//Cart has item(s) in it. Do something.
}April 15, 2017 at 12:26 pm #75493grhapa
MemberThank you.
Is there any link where I can find such functions/api?
April 15, 2017 at 12:41 pm #75494grhapa
MemberContinuing the same thread.
I noticed digi_cart_not_empty() doesn’t work across multiple machine.
Is the cart update serialize into DB? How do I access that to enable cart visibility across machine ?
April 15, 2017 at 1:15 pm #75495wzp
ModeratorIs there any link where I can find such functions/api?
That is an internal (undocumented) function call.
I noticed digi_cart_not_empty() doesn’t work across multiple machine.
The scope of eStore functionality is limited to the WordPress instance on which it is installed.
Is the cart update serialize into DB?
The cart is maintained via the use of PHP sessions:
[http://php.net/manual/en/features.sessions.php]
However, if you use the “Save and Retrieve Cart Feature,” the cart will be saved in the database:
https://www.tipsandtricks-hq.com/ecommerce/wp-estore-save-and-retrieve-cart-feature-2464
April 15, 2017 at 1:57 pm #75496grhapa
MemberThanks
It doesn’t seems to work for me. I am using button url as below
[http://www.mydomain.com/?wp_eStore_save_retrieve_cart=1]
While following url works for me but per WP session (not across machine)
[http://www.mydomain.com/?wp_eStore_add_to_cart=1]
April 15, 2017 at 3:41 pm #75497wzp
ModeratorIt doesn’t seems to work for me. I am using button url as below
[http://www.mydomain.com/?wp_eStore_save_retrieve_cart=1]
It will only work as a shortcode, on the same WordPress instance that it was installed on. You cannot invoke it, from another site, using a URL query.
April 15, 2017 at 6:21 pm #75498grhapa
MemberThanks for quick update.
-
AuthorPosts
- You must be logged in to reply to this topic.