[wcdp_order_counter] Shortcode

The [wcdp_order_counter] shortcode is a powerful new feature added in Donation Platform for WooCommerce v1.3.2. This shortcode allows you to display the number of orders for a specific product on your website, providing transparency and encouraging further donations.

Attributes

The [wcdp_order_counter] shortcode comes with several attributes that you can customize to fit your needs:

  • id (required): The product ID for which you want to display the order count.
  • label (optional): The text that will be displayed alongside the order count. The placeholder {ORDER_COUNT} will be replaced with the actual number of orders. The default value is {ORDER_COUNT} people have already contributed to this project.
  • fallback (optional): The label to be used when there are 0 orders. If not set, the default label will be used.
  • cheat (optional): A positive or negative integer used to manipulate the number of orders displayed. This can be used to include external donations or for testing purposes.

Usage Examples

Here are some examples of how to use the shortcode:

Basic Usage

To display the number of orders for a product with ID 123:

[wcdp_order_counter id="123"]

Custom Label

To display a custom message along with the order count:

[wcdp_order_counter id="123" label="Amazing! {ORDER_COUNT} people have supported this cause!"]

Fallback Label

To set a custom fallback message when there are 0 orders:

[wcdp_order_counter id="123" fallback="Be the first to support this cause!"]

Cheat Attribute

To adjust the displayed order count, for example, adding 5 to the actual count:

[wcdp_order_counter id="123" cheat="5"]

Or to subtract 3 from the actual count:

[wcdp_order_counter id="123" cheat="-3"]

Full Example

Combining all attributes for a comprehensive setup:

[wcdp_order_counter id="123" label="{ORDER_COUNT} supporters so far!" fallback="No supporters yet, be the first!" cheat="-2"]

In this example, for the product with ID 123, the displayed message will be “{ORDER_COUNT} supporters so far!“. If there are no orders, it will show “No supporters yet, be the first!“. Additionally, 2 will be removed from to the actual order count.

Conclusion

The [wcdp_order_counter] shortcode is a versatile tool for displaying the number of orders for your products, enhancing transparency, and encouraging donations. Customize it using the provided attributes to fit your specific needs and improve user engagement on your site.