最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

plugins - Reverse count page view and show on other page

programmeradmin0浏览0评论

is there any php function for the child theme or plugin that makes the following possible in wordpress:

  1. Page A shows number 16

  2. Website visitor visits page B

  3. Page A shows number 15

I would like to have a checkout page (A) that shows a limited offer (number). After purchase the customer is sent to the thank you page (B).This should trigger the number in the checkout page (A) to go down by 1.

Any idea?

Additionally it would be great, if the number reaches 0 and (through php?) if this is reached, the vistor of page A will be redirected to page C.

is there any php function for the child theme or plugin that makes the following possible in wordpress:

  1. Page A shows number 16

  2. Website visitor visits page B

  3. Page A shows number 15

I would like to have a checkout page (A) that shows a limited offer (number). After purchase the customer is sent to the thank you page (B).This should trigger the number in the checkout page (A) to go down by 1.

Any idea?

Additionally it would be great, if the number reaches 0 and (through php?) if this is reached, the vistor of page A will be redirected to page C.

Share Improve this question asked May 6, 2019 at 9:14 AlexAlex 1
Add a comment  | 

1 Answer 1

Reset to default 0

It depends on what plugin(s) you are using.

Most ecommerce plugins do provide support for inventory. This means that as the shop owner, you can tell the plugin how many of product X you have in stock. Once someone buys an item, the plugin subtracts one, so if you start with 16 of the item and someone buys 1, then the plugin will automatically adjust the inventory to 15. This is better than relying on a pageview - if for example they leave the site to pay on PayPal's website, many visitors don't continue back to the original site and view the confirmation page that you were thinking of using to trigger the reduction of inventory.

As far as redirection, you would also need to create a child theme, and in that child theme's product detail page (often single-product.php), you would need to set up a check before outputting any content. So, check the inventory of the current product, and if the inventory == 0, redirect to the page of your choice. Else, display the product detail page.

发布评论

评论列表(0)

  1. 暂无评论