Product Interval Is Editable
-
Hello,
I have been working around this plugin for sometimes and it’s awesome until I found this bug.
I set the Interval to 10 and it works on both button -+ (product page or cart page) BUT, when I change the value manually (not by the button) like 11, it still appliable.
Can I get some tweaking here? so the user will not be able to do that?
Cheers,
slimmz
-
Thanks for notifying me. will look into it asap.
I’m hoping an update soon, I will be so thankfull
Hello @wpashokg Any news about this?
@slimmz sorry for the delay. Bit stuck with my official tasks. Need to find some time tomorrow.
All right mate,
I wish it could be done ASAP because my company is about to launch the site and I don’t want that bug still there heheCheers,
slimmz@slimmz can you share me the demo link.
coz, when I tested it I’m getting it working properly as expected.Nice to hear you back,
Here is the link to one of the products:
https://www.ptpasonline.com/product/bosch-5pcs-cyl-2-impact-masonry-drill-bits-set-456810mm/Here is your demo login:
demo
Demo123Here is some back end settings of the product:
https://ibb.co/Xz8mZhb
https://ibb.co/njG2TDk
https://ibb.co/611ZRDyIn this case, i set the rule, but you can try by your self that you can even pass the product to cart below the minimum requirement, i also set the step to 5, but you can try to mess with the value.
I hope this is just a bug and will be fixable
function wc_mmax_custom_add_to_cart($args, $product) { $orderQTY = $_POST['quantity']; $mmaxEnable = get_post_meta($product, '_wc_mmax_prd_opt_enable', true); $minQty = get_post_meta($product, '_wc_mmax_min', true); $maxQty = get_post_meta($product, '_wc_mmax_max', true); $incrementbyQty = get_post_meta($prodid, '_wc_mmax_increment', true); $cartQty = wc_mmax_woo_in_cart($product); if (get_option('_wcmmax_options_option_name') != NULL && get_option('_wcmmax_options_option_name') != '') { $maxQTYMsg = get_option('_wcmmax_options_option_name'); } else { $maxQTYMsg = 'You have already added the maximum Quantity for the product for the current purchase'; } if ($maxQty < $cartQty && $mmaxEnable == 1) { wc_add_notice($maxQTYMsg, 'error'); exit(wp_redirect(get_permalink($product))); } if ((($orderQTY + $cartQty) < $minQty || ($orderQTY + $cartQty) % $incrementbyQty > 0) && $mmaxEnable == 1) { wc_add_notice(__('You have ordered ' . $orderQTY . ' which is less than the allowed Minimum Quantity ' . $minQty . ' or its not incremented in the specific format of x ' . $incrementbyQty, 'wcmax'), 'error'); exit(wp_redirect(get_permalink($product))); } }
can you replace the entire function in the plugin file.
function to be replaced wc_mmax_custom_add_to_cart
and give me an update
skype: phpkidindiaHow to do that?
I only know to add that code in my function.php file, not in the plugin file, is it the same?
Or tell me how to do that,
But first, you can check again since I have made that changes
Now on the cart page, it is limited to be set by the rule of min/max/step, but on the product page, still not working
EDIT: I figure it out on how to edit the plugin, i will update soon
- This reply was modified 3 years, 5 months ago by slimmz.
@wpashokg
Not sure which code to overwrite, i found this in your plugin<?php /** * The plugin bootstrap file * * This file is read by WordPress to generate the plugin information in the plugin * admin area. This file also includes all of the dependencies used by the plugin, * registers the activation and deactivation functions, and defines a function * that starts the plugin. * * @link https://codeixer.com * @since 1.0.0 * @package Wc_Mmqty * * @wordpress-plugin * Plugin Name: CI WooCommerce Minimum Maximum Quantity & Step Control * Plugin URI: https://codeixer.com/wcmmqty * Description: This plugin allow you to setup limits for your shop products * Version: 1.0.0 * Author: codeixer * Author URI: https://codeixer.com * License: GPL-2.0+ * License URI: https://www.gnu.org/licenses/gpl-2.0.txt * Text Domain: wc-mmqty * Domain Path: /languages */ // If this file is called directly, abort. if ( ! defined( 'WPINC' ) ) { die; } /** * Currently plugin version. * Start at version 1.0.0 and use SemVer - https://semver.org * Rename this for your plugin and update it as you release new versions. */ define( 'WC_MMQTY_VERSION', '1.0.0' ); define( 'WC_MMQTY_INC', plugin_dir_path( __FILE__ ) . 'inc/'); define( 'WC_MMQTY_ROOT', plugin_dir_path( __FILE__ ) .''); //--------------------------------------------------------------------- // Add setting API //--------------------------------------------------------------------- require_once plugin_dir_path(__FILE__) . '/inc/class.settings-api.php'; //--------------------------------------------------------------------- // Plugin Options //--------------------------------------------------------------------- require_once plugin_dir_path(__FILE__) . '/inc/options.php'; new wcmmqty_Settings_API(); function wc_mmqty_option( $option, $section = 'wcmmqty_settings', $default = '' ) { $options = get_option( $section ); if ( isset( $options[$option] ) ) { return $options[$option]; } return $default; } class WC_MMQTY{ function __construct() { add_action('plugins_loaded',array($this,'load_plugin_code')); add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) ); } function load_plugin_code(){ require_once WC_MMQTY_INC . 'wc-mmqty-public.php'; require_once WC_MMQTY_INC . 'wc-mmqty-admin.php'; } function load_textdomain() { load_plugin_textdomain( 'wc-mmqty', false, plugin_dir_url( __FILE__ ) . "/languages" ); } } new WC_MMQTY();
Can you mark the code i should replace?
@slimmz can you check the latest version of plugin.
Sorry, i was copying the wrong plugin’s code above @wpashokg ,
But yeah, I did update your plugin but the order qty still can be messed around, you can check it again.
Update:
1. When I put qty below the minimum limit, it redirects me to the cart page but not adding the product
2. Also when I put the qty outside of the increment rule, it redirects me to the cart page but not adding the product tooCan you make it show a warning message instead of redirecting to the cart page
cheers,
slimmzOne more thing, can I do import and export the min/max/interval value from excel?
Via Woocommerce export/import featureCheers,
slimmzEdit: Yes I can, I just tried it ??
Back to the problem above this reply- This reply was modified 3 years, 5 months ago by slimmz.
which theme you are using @slimmz I tried with few free store themes I’m able to give the error messages properly.
I’m using paid theme: Nitro
Where should the warning appear?
- This reply was modified 3 years, 5 months ago by slimmz.
- The topic ‘Product Interval Is Editable’ is closed to new replies.