The plugin for WordPress +WooCommerce allows you to make purchases in one click. The plugin has many additional settings to control the form and the behavior of the form when placing an order.
Requirements
- The latest version of WordPress
- The best online commerce plugin WooCommerce
- PHP >= 7.4 (From plugin version 2.0.0)
- A little patience to configure the plugin :)
License URI: http://www.apache.org/licenses/
You can add this code to the file function.php your theme, so that it would start working
- Allow uploading via the zip file extension form
add_filter('coderun_oneclickwoo_file_valid_extension',
static function (array $item): array {
$item[] = 'zip';
//... any other types
return $item;
});
- Increase the file size limit
add_filter('coderun_oneclickwoo_file_valid_size',
static function ($size): int {
return 100000000; //bytes
});
- Add allowed mime types
add_filter('coderun_oneclickwoo_file_valid_mime_types',
static function (array $mime): array {
$mime[] = 'application/vnd.oasis.opendocument.text';
//... any other mime
return $mime;
});
- Change the names of uploaded files
add_filter('coderun_oneclickwoo_file_name',
static function (string $newName, string $originalName): string {
// ... Here is your magic over the name
return $newName;
});
- All the hooks and filters of the plugin
Coderun\BuyOneClick\Utils\Hooks::class
- A shortcode that can work where there is a withdrawal of goods.
[viewBuyButton]
- A shortcode with a valid WooCommerce product ID. Can be used anywhere on the site
[viewBuyButton id="you_product_id"]
// Exemple:
[viewBuyButton id="10"]
[viewBuyButton id="674"]
...
- The shortcode for your product. The product may not exist in your online store, all product parameters are transmitted via a shortcode
[viewBuyButtonCustom id="your product ID" name="your product name" count="the quantity transferred with the purchase" price="price per unit of goods" price_with_currency="price with currency to display"]
// Exemple:
[viewBuyButtonCustom id="xxx01" name="Elon Reeve Musk Aircraft" count="1" price="9320000"]
[viewBuyButtonCustom id="code812-323" name="Cucumbers in a jart" count="1" price="600" price_with_currency="600 USD"]
... // Any of your data in the shortcode, sell anything
- The action called after the order is created
add_action('buy_click_new_order',
static function (array $pluginOrder, array $orderField): void {
// Here are your actions, if necessary
},
10 ,2);
The set of fields can be changed through the plugin settings, as well as make them mandatory.
In the plugin settings, you can change the position of the button, as well as place the button in the product catalog
The plugin has many settings related to the display of the button, the design of the form. There is a section with orders.