How to integrate a shortcode in a button in WordPress?
Problem Statement
You want to add Chargebee shortcodes as buttons on your WordPress site. You may also need to know which deprecated shortcodes are still supported.
Solution
Option 1: Use the Checkout Subscription Shortcode in WordPress.
Option 2: Use the drop-in script to load checkout when a button is clicked. The checkout opens on your page when the customer clicks Subscribe.
Shortcodes
Account Portal: [cb_account_portal class="btn"]Account[/cb_account_portal]
Product Subscribe: [cb_product_subscribe_hosted class="btn" product_id="cbdemo_grow"]Subscribe[/cb_product_subscribe_hosted]
Deprecated shortcodes (still supported)
These can be used for restrictions or sign-up flows:
- cb_login_form
- cb_registration_form
- cb_account_link
- cb_update_payment_method_form
- cb_product_subscribe
Additional Information
Was this article helpful?