Download the PHP package pfaciana/wc-helpers without Composer
On this page you can find all versions of the php package pfaciana/wc-helpers. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pfaciana/wc-helpers
More information about pfaciana/wc-helpers
Files in pfaciana/wc-helpers
Package wc-helpers
Short Description Additional classes and functions to help with writing code for WooCommerce
License GPL-2.0-only
Homepage https://renderdev.com/
Informations about the package wc-helpers
Render WooCommerce Helpers
Additional classes and functions to help with writing code for WooCommerce
Getting Started
Basic usage is to use the RWC() function which is an alias for RenderWooCommerce instance (RenderWooCommerce::get_instance())
NOTE:
renderwoocommerce_loadedruns early in theplugins_loadedhook. So you can hook into any action that runs on or afterplugins_loaded.
More options...
The field methods for product data are aliases for the woocommerce_wp_* methods provided by WooCommerce, with a few enhancements and extra features. However, if you're familiar with those functions, the arguments are basically the same. The variation and addon fields have been added to work the same way, making the calls interchangeable. They act like polymorphic functions. The input parameters for, say, datatime() is the same regardless if the $panel or $group is from a product data, variation, or addon section.
The purpose of this is to make it easier and, more importantly, faster to write code that works with any of the three contexts. Rather than managing three different sets of code that do the same thing, just in different areas of a product page.
Available Fields
texttextareahiddenradiocheckboxselect/select2@see select2productvariationdatetime/datetime1@see datetime1date/date1@see date1time/time1@see time1coloremailnumberpasswordrangetelurl
Available $args
Alphabetical order.
cbvalue(string) - checkbox. the value of the checkbox IF checked. Defaults to1class(string)config(array) - select2custom_attributes(array) - any additional html attributes to add to the fielddata_type(string) - WooCommerce field typedesc_tip(bool) - whether to show the description as a tooltip. Defaults toFALSEdescription(string)id(string)label(string)name(string)options(array) - radio, select, select2, product, variationplaceholder(string)style(string)type(string) - HTML form type attributevalue(string) - can be auto-populated from the post metawrapper_class(string)
Available Classes
In addition to the conditional classes (that can be placed on panels, groups and fields in the conditionals $args key)...
show_if_*andshow_if_*_is_*hide_if_*andhide_if_*_is_*require_if_andrequire_if_*_is_*no_require_if_andno_require_if_*_is_*
NOTE: the
*_if_*_is_*also matches on field value. The value is converted to lowercase alphanumeric characters with '_' and '-'.So a field named
some_numberwith a value equal to1could have a conditional likeshow_if_some_number_is_1.Or if a field named
some_colorhas a value of#FF0000could have a conditional likehide_if_some_color_is__ff0000.Or if a field name
some_texthas a value of[@field] #-100.5!could have a conditional likeno_require_if_some_text_is___field___-100_5_.
...There are also a few wrapper classes (that can be placed on groups and fields in the wrapper_class $args key).
Variation Field wrapper_class options
form-row-first- field column is 50% width, placed first-
form-row-last- field column is 50% width, placed last form-row-first-third- field column is 33.3% width, placed firstform-row-middle-third- field column is 33.3% width, placed as the middleform-row-last-third- field column is 33.3% width, placed last
Add-on Field wrapper_class options
rwc-pao-column-1-2- field column is 50% widthrwc-pao-column-1-3- field column is 33.3% widthrwc-pao-column-2-3- field column is 66.7% width
Add-on Groups wrapper_class options
rwc-pao-columns-1-2- all child field columns are 50% widthrwc-pao-columns-1-3- all child field columns are 33% widthrwc-pao-columns- all child field columns are auto-sized