Skip to content
Commits auf Quelle (5)
## [1.7.11](https://git.triopsi.dev/triopsi/extra-product-data-for-woocommerce/compare/v1.7.10...v1.7.11) (2025-02-05)
### Bug Fixes
* the product can only be purchased once ([833f059](https://git.triopsi.dev/triopsi/extra-product-data-for-woocommerce/commit/833f0597c1c2d76e4bf471c0891d235434b7d5dd))
* the product can only be purchased once ([96a12f7](https://git.triopsi.dev/triopsi/extra-product-data-for-woocommerce/commit/96a12f7bf83fd1ba25be3e5175dda1ed7ad1a118))
## [1.7.10](https://git.triopsi.dev/triopsi/extra-product-data-for-woocommerce/compare/v1.7.9...v1.7.10) (2025-01-18)
......
......@@ -21,7 +21,7 @@ Project: | Woocommerce Extra Product Data
| Requires at least | 5.0 |
| Tested up to | 6.x |
| Requires PHP | 8.2 |
| Stable tag | 1.7.10 |
| Stable tag | 1.7.11 |
| License | GPLv2 or later |
| License URI | https://www.gnu.org/licenses/gpl-2.0.html |
......
......@@ -2,7 +2,7 @@
/*
Plugin Name: Extra Product Data for WooCommerce
Description: Adds customizable input fields per product in WooCommerce, allowing users to enter extra details on the frontend.
Version: 1.7.10
Version: 1.7.11
Author: Triopsi
Author URI: https://triopsi.dev
License: GPLv2 or later
......
......@@ -4,7 +4,7 @@ Tags: WooCommerce Product Addons, WooCommerce product options, WooCommerce custo
Requires at least: 5.0
Tested up to: 6.7
Requires PHP: 8.2
Stable tag: 1.7.10
Stable tag: 1.7.11
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
......@@ -146,4 +146,7 @@ Yes, the plugin has been tested with the latest WordPress release and PHP 8.2.
* Bug fix: admin can edit the custom fields
= 1.7.9 (13.01.2025) =
* Bug fix: css fix on user edit page
\ No newline at end of file
* Bug fix: css fix on user edit page
= 1.7.10 (05.02.2025) =
* Bug fix: the product can only be purchased once
\ No newline at end of file
......@@ -269,9 +269,20 @@ class Exprdawc_Product_Page_Fronted {
if ( ! $product ) {
return $passed;
}
$custom_fields = $product->get_meta( '_extra_product_fields', true );
if ( ! empty( $custom_fields ) ) {
// Check if the product can only be purchased once.
if ( $product->get_sold_individually() ) {
foreach ( WC()->cart->get_cart() as $cart_item ) {
if ( $cart_item['product_id'] == $product_id ) {
wc_add_notice( __( 'This product can only be purchased once.', 'extra-product-data-for-woocommerce' ), 'error' );
return false;
}
}
}
foreach ( $custom_fields as $index_num => $input_field_array ) {
// Actual label lowercase and without spaces and _ are -.
......