Skip to content
Advertisement

How to reference a custom product type value in HTML/PHP (WordPress & Woocommerce)

I have a custom button that instead of the ‘add to cart’ button. It should open a link to the brand: id=’_brands_link’ and in the button, and after “Bestel bij” there should be the brand name id=’_brands_name’ (see the created fields in the bone product):

JavaScript

I have a function of this buttons now:

JavaScript

So in action instead of https://www.google.com there should be _brands_link. And instead of “Google”, which is in the button, there should be _brands_name

Here’s all the code for my custom product type, just in case:

JavaScript

CONCLUSION: I need to understand how to correctly reference the objects of the classes I created for _brands_link and _brands_name. I do not understand how this should be done, so that it would be displayed in HTML as text (_brands_name) and as a link in the form action = “” (_brands_link):

JavaScript

Advertisement

Answer

Since are save them as post meta data, you could get back as meta too

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement