Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added two new filters to the foxyshop_product_variations function #30

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

summersab
Copy link

Added two new filters to the foxyshop_product_variations function (third time is a charm):

foxyshop_before_variation_field - allows adding code prior to the variation form field element
foxyshop_after_variation_field - allows adding code after the variation form field element
Added a $labelPosition option to the foxyshop_product_variations function to allow the variation titles to be displayed as placeholder values in the form field elements

Added two new filters to the foxyshop_product_variations function:

foxyshop_before_variation_field - allows adding code prior to the variation form field element
foxyshop_after_variation_field - allows adding code after the variation form field element
Added a $labelPosition option to the foxyshop_product_variations function to allow the variation titles to be displayed as placeholder values in the form field elements
Similar to Contact Form 7, FoxyShop loads its CSS on every page of the website. There may be better ways to handle this, but the way it is handled in CF7 is adding a filter that can be used like so:
```
add_filter( 'foxyshop_load_css', '__return_false' ); // Disable FS CSS
add_action('wp_enqueue_scripts', 'load_foxyshop_scripts');
function load_foxyshop_scripts() {
	//is_page can take an array that uses page title, slug, or ID such as array( 23, 'about-us', 'Contact' )
	if ( is_page( array( '235', 'daisies' ) ) ) {
		if ( function_exists( 'foxyshop_do_load_site_scripts' ) ) {
			foxyshop_do_load_site_scripts();
		} 
	}
}
```
This helps with PageSpeed and SEO.
I'm not sure if I can justify this PR without the other changes I've made and added to my site's functions.php. However, this small tweak takes into account the scenario where a user has placeholder text in the quantity select box (it is required that the option be set with the attribute `value="0"`). Prior to this change, the price update would show NaN as a new total price. After this change, the update looks to see if the value is 0. Otherwise, it takes the value of the text.
Update variation.process.jquery.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant