OxyElements

Woo Fields

Projects info
EXAMPLE:

SoundLink® Revolve+ (Product Simple)

Current product information
Product Type:
simple
Creation date:
24 - Jun - 2024
Is it a featured product? :
no
Price:
$15.00
Regular price:
$25.00
Sale price:
$15.00
Does this product have a variable price?:
no
Stock quantity:
49
Stock status:
instock
Allow ordering:
yes
Discount in percentage:
-40%
Discount on amount:
$10.00
Total sales:
0
Upsells Ids products:
31,35
Score percentage:
0.0
Review count:
0
Field value from ACF or another plugin:
#1e73be
Field value with style:
color: #1e73be;
And many more....
Introduction:
Unlimited Woo Features is an advanced WooCommerce tool designed to give you unparalleled control over your product data. This function allows you to extract and utilize almost any value that exists within WooCommerce, enabling you to customize various aspects of your products effortlessly. From simple data retrieval like product prices and creation dates to more advanced functionalities such as displaying ratings and applying dynamic CSS styles based on product attributes, Unlimited Woo Features opens up a world of possibilities.

With this function, you can seamlessly integrate dynamic data into Oxygen Builder, making your WooCommerce site more flexible and personalized. Whether you want to conditionally display elements based on product types, dynamically apply styles to elements, or simply retrieve specific product data for use in your design, Unlimited Woo Features provides a robust and versatile solution.
Installation:
Note: I update this function constantly, visit this page to review new fields
1- PHP Snippet:
Add the following PHP snippet to your preferred plugin like Code Snippets
Usage:
There are several ways to use this function:
  • Inserting Data in Text:
    1. Select a text element in Oxygen Builder.
    2. Press the "Insert Data" button in the Advanced section.
    3. Choose "PHP Function Return Value" and set the function name to woo_field.
    4. In "Function Arguments", specify the field you want to call, for example, price, to retrieve the current product price.
  • Using Conditions:
    1. Select the element to condition.
    2. Press the "Conditions" icon.
    3. Go to Settings > Set conditions > Add your first condition.
    4. In the "Choose Condition" dropdown, select "Dynamic Data" and then "PHP Function Return Value".
    5. Set the function name to woo_field and in "Function Arguments", specify the field, for example, type, to retrieve the product type.
    6. In the second dropdown, set the condition (e.g., =) and in the last field, specify the value (e.g., variable).
    7. This will show the element only if the current product is a variable product.
  • Adding Style Attributes:
    1. Select the element and go to the element's parameters in Advanced > Attributes.
    2. Press "Add Attribute" and in the "Name" field, enter style.
    3. In the "Value" field, press the "Data" button, go to Advanced, and choose "PHP Function Return Value".
    4. Set the function name to woo_css and in "Function Arguments", specify the CSS property (e.g., width), a |, the field name (e.g., an ACF field called width_product), and another | followed by the unit (e.g., %), resulting in width|width_product|%.
    5. This will add a style like width: 55%; to the element.
    6. You can also use color|color_product, which will return color:#ffffff; and apply this color to the element.
Customization:
Cases That Depend on a Product

id: Extracts the product ID
Example: Returns 123 for a product with ID 123

type: Extracts the product type
Example: Returns variable for a variable product

name: Extracts the product name
Example: Returns T-Shirt for a product named T-Shirt

slug: Extracts the product slug
Example: Returns t-shirt for a product with this slug

date_created: Formats the creation date of the product
Example: Returns 11 - Jul - 2023 for a product created on 2023-07-11

date_modified: Formats the modification date of the product
Example: Returns 12 - Jul - 2023 for a product modified on 2023-07-12

status: Extracts the product status
Example: Returns publish if the product status is publish

featured: Extracts if the product is featured and converts it to 'yes' or 'no'
Example: Returns yes if the product is featured, otherwise no

catalog_visibility: Extracts the product catalog visibility
Example: Returns visible if the product is visible in the catalog

description: Extracts the product description
Example: Returns This is a high-quality T-Shirt. if that's the product description

short_description: Extracts the product short description
Example: Returns Comfortable and stylish. if that's the product's short description

sku: Extracts the product SKU
Example: Returns TSHIRT001 for a product with this SKU

menu_order: Extracts the product menu order
Example: Returns 5 if the product's menu order is 5

virtual: Extracts if the product is virtual and converts it to 'yes' or 'no'
Example: Returns yes if the product is virtual, otherwise no

price: Extracts the product price
Example: Returns $19.99 for a product priced at $19.99 (tax included/excluded depending on the WooCommerce settings)

regular_price: Extracts the regular price of the product
Example: Returns $24.99 if the regular price is $24.99 (tax included/excluded depending on settings)

sale_price: Extracts the sale price of the product
Example: Returns $19.99 if the sale price is $19.99 (tax included/excluded depending on settings)

tax_suffix: Extracts the tax suffix from WooCommerce settings
Example: Returns (includes VAT) if that's set in WooCommerce

tax_included: Indicates if prices include tax
Example: Returns yes if prices include tax, otherwise no

price_tax_included: Extracts the product price including taxes
Example: Returns $21.99 if the price is $19.99 with $2.00 tax included

price_tax_excluding: Extracts the product price excluding taxes
Example: Returns $19.99 if taxes are excluded

find_variable_price: Checks if the current product is variable
Example: Returns yes if the product has multiple variations with different prices, otherwise no

is_on_sale: Verifies if the product is on sale
Example: Returns yes if the product is on sale, otherwise no

date_on_sale_from: Extracts the sale start date
Example: Returns 01 - Jul - 2023 if the sale starts on July 1, 2023

date_on_sale_to: Extracts the sale expiration date
Example: Returns 10 - Jul - 2023 if the sale ends on July 10, 2023

date_on_sale_to_year: Extracts the year of sale expiration
Example: Returns 2023 if the sale ends in 2023

date_on_sale_to_month: Extracts the month of sale expiration
Example: Returns 07 if the sale ends in July

date_on_sale_to_day: Extracts the day of sale expiration
Example: Returns 10 if the sale ends on the 10th

discount_percentage: Calculates the discount percentage
Example: Returns -25% if the regular price is $100 and the sale price is $75

discount_amount: Calculates the discount amount in money
Example: Returns $25.00 if the regular price is $100 and the sale price is $75

total_sales: Extracts the total sales of the product
Example: Returns 50 for a product that sold 50 units

tax_status: Extracts the tax status of the product
Example: Returns taxable if the product is taxable

tax_class: Extracts the tax class of the product
Example: Returns standard-rate if the product is in that class

manage_stock: Extracts if the product manages stock
Example: Returns yes if it manages stock, otherwise no

stock_quantity: Extracts the stock quantity of the product
Example: Returns 20 if there are 20 units in stock

stock_status: Extracts the stock status of the product
Example: Returns instock if the product is available, otherwise outofstock

backorders: Extracts the backorder status of the product
Example: Returns notify if backorders are allowed with notification

sold_individually: Extracts if the product is sold individually
Example: Returns yes if sold individually, otherwise no

purchase_note: Extracts the purchase note of the product
Example: Returns Thank you for your purchase! if set

shipping_class_id: Extracts the shipping class ID of the product
Example: Returns 123 for a shipping class ID

weight: Extracts the product weight
Example: Returns 1.5 kg if the product weighs 1.5 kg

length: Extracts the product length
Example: Returns 20 cm if the length is 20 cm

width: Extracts the product width
Example: Returns 10 cm if the width is 10 cm

height: Extracts the product height
Example: Returns 15 cm if the height is 15 cm

dimensions: Extracts the product dimensions
Example: Returns 20 cm x 10 cm x 15 cm

upsell_ids: Extracts the upsell product IDs
Example: Returns 101,102 for upsell product IDs

cross_sell_ids: Extracts the cross-sell product IDs
Example: Returns 201,202 for cross-sell product IDs

parent_id: Extracts the parent product ID
Example: Returns 456 if it has a parent product

children: Extracts child product IDs (variations)
Example: Returns 789,101 for child product IDs

children_names: Extracts the attribute names of child products
Example: Returns Red, Large if child products have those attributes

attributes: Extracts product attributes
Example: Returns Color, Size if those are attributes

default_attributes: Extracts default attributes of the product
Example: Returns Red, Medium if those are set

attribute: Extracts a specific attribute value of the product
Example: Returns Blue for a color attribute

category_ids: Extracts the category IDs
Example: Returns 12,34 if the product belongs to these categories

tag_ids: Extracts the tag IDs
Example: Returns 56,78 if the product has these tags

downloads: Extracts the downloadable files of the product
Example: Returns {"File1.zip": "URL", "File2.pdf": "URL"}

download_expiry: Extracts download expiry days
Example: Returns 30 if it expires in 30 days

downloadable: Checks if the product is downloadable
Example: Returns yes if it is downloadable

download_limit: Extracts the download limit of the product
Example: Returns 5 if the limit is 5 downloads

image_id: Extracts the ID of the main product image
Example: Returns 123

image: Extracts the main product image HTML
Example: Returns <img src="image_url.jpg" alt="Product Image">

gallery_image_ids: Extracts the gallery image IDs
Example: Returns 456,789

gallery_first_image_id: Extracts the first gallery image ID
Example: Returns 456

reviews_allowed: Checks if reviews are allowed
Example: Returns yes if allowed

has_ratings: Checks if the product has ratings
Example: Returns yes if it has ratings

rating_counts_1 to rating_counts_5: Extracts counts for 1 to 5-star ratings
Example: Returns 10 for 10 ratings

average_rating: Extracts the average rating
Example: Returns 4.5

rating_percentage_1 to rating_percentage_5: Calculates percentage for 1 to 5-star ratings
Example: Returns 10% for 10%

review_count: Extracts total reviews
Example: Returns 50

find_cart: Checks if the product is in the cart
Example: Returns yes if it is in the cart

cart_link: Extracts a custom cart link
Example: Returns ?add-to-cart=789

cart_item_key: Extracts the cart item key
Example: Returns abcdef12345

remove_cart_url: Extracts the remove URL
Example: Returns https://yourwebsite.com/?remove_item=abcdef12345

Cases That Do Not Depend on a Product

cart_product_ids: Extracts all product IDs from the cart
Example: Returns 123,456 if those products are in the cart

cart_total_items: Extracts the total number of items in the cart
Example: Returns 3 if there are three items

cart_total_price: Extracts the total price of all items in the cart
Example: Returns $59.99 if that's the total cart price

Advanced:
If you have an ACF repeater, you must place your ACF repeater in Oxygen Builder and call it. It is important to first add acf_ + the ACF field that will be used within the repeater. This is useful for calling woo_css inside an ACF repeater if necessary.
Thanks for visiting my page
CLOSE
If any of my work works for you, you can help me continue generating content by making a donation from PayPal: Donate
If you want a special project or modify some of my projects you can send me the details of your project and budget by Messenger  (There is no low budget)