Jump to content

Recommended Posts

Hey guys, i need to Amend the quantity rules plugin to allow rules on product variations also.  Now I cant seem to find a way of doing this currently. I am still learning php/wordpress etc so its a bit above me at the moment. Im assuming i would need to add something in here? 

function wpbo_get_applied_rule( $product, $role = null ) {
	
	// Check for site wide rule
	$options = get_option( 'ipq_options' );
	
	if ( get_post_meta( $product->id, '_wpbo_deactive', true ) == 'on' ) {
		return 'inactive';
		
	} elseif ( get_post_meta( $product->id, '_wpbo_override', true ) == 'on' ) {
		return 'override';
	
	} elseif ( isset( $options['ipq_site_rule_active'] ) and $options['ipq_site_rule_active'] == 'on' ) {
		return 'sitewide';
		
	} else {
		return wpbo_get_applied_rule_obj( $product, $role );
	}
} 

 

Edited by Thatch77
Link to comment
https://forums.phpfreaks.com/topic/305918-allow-variable-rules-on-quantity-rules/
Share on other sites

Hi @Thatch77,

 

We are little lost with your question, have you looked in Wordpress admin dashboard for any of the options you're trying to achieve?

 

It looks like you could edit some code here for your objective, you could create another condition (quantity), though it may never get called or used, there is missing code and I am assuming this is a third-party add-on, may want to check on the third-party add-on web page.

 

 

 

Example only... does nothing... Where was the variables $quanity and $amt set?? Where is it returned too?? and how are they used??

	} elseif ( !empty($quanity) and !empty($amt)) {
		$quanity = $amt;
		return '$quanity';
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.