Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/drizy/la-course-purchase/archive/refs/heads/main.zipAdds a purchasable price field to a custom post type and lets visitors buy the item through the native WooCommerce checkout and PayPal payment flow.
Description
LA Course Commerce connects a WordPress Custom Post Type (CPT) to the WooCommerce checkout. Perfect for selling courses, training sessions or consulting packages that are already published as CPT entries.
- Adds a price field to your chosen CPT (native WordPress meta box).
- Turns any button on the CPT single page into a purchase button without editing theme templates.
- Adds the item to the WooCommerce cart dynamically and redirects to checkout. No custom cart system is used — WooCommerce is the engine.
- Works with the PayPal Payments gateway (WooCommerce PayPal Payments or the legacy PayPal Standard gateway) and shows guidance when PayPal is not configured.
- Keeps a reference to the bought CPT entry on the order and each order line item for reconciliation.
- Prices are always read from server-side post meta, so visitors cannot manipulate the amount.
Installation
- Upload the
la-course-commercefolder to/wp-content/plugins/or install via Plugins → Add New. - Activate the plugin. WooCommerce must be installed and active.
- Go to WooCommerce → Course Purchases.
- Select the CPT you want to make purchasable (e.g.
course) and confirm the price meta key (default_la_price). - On the CPT edit screen, set the price of each item in the Purchase price meta box.
- Add the purchase-button class (default
.la-buy-now) to your existing "Sign Up Now" button. With Elementor: edit the button → Advanced → CSS Classes → enterla-buy-now. - Enable PayPal under WooCommerce → Settings → Payments.
Frequently Asked Questions
Does the plugin create WooCommerce products for every CPT item?
No. A single hidden "Course Registration" product is used as a cart vehicle. Each cart line records the CPT reference, and the price is re-read from the CPT post meta on every cart calculation.
What if my checkout page does not exist?
Enable "Auto-create checkout page" in the settings. A page containing the
[woocommerce_checkout] shortcode is created and assigned to WooCommerce.
How is the purchase price protected from manipulation?
The price is never taken from the browser. The AJAX handler only receives the
CPT post ID (validated against a nonce); the amount is always read from post
meta server-side and re-applied via woocommerce_before_calculate_totals.
Which PayPal gateway is supported?
WooCommerce PayPal Payments (gateway ppcp-gateway) and the legacy PayPal
Standard gateway. If neither is enabled you will see guidance in the admin.
Changelog
1.0.0
- Initial release.
Upgrade Notice
1.0.0
- Initial release.