I am working in woocommerce using the wc ()
function. It says that gives the main example of WC to stop the need to use Global.
I can not find any examples of its use and I would like to know how to use wc () to do some basic things, I think it gives a main woocommerce example ; And from that I can get all the data that I want; But I do not know the syntax for the right use ... can there be something like this?
$ foo = WC (); $ Bar = $ foo- & gt; Cart; Counterpart $ bar;
Can someone please correct it?
In addition to this, I am trying to understand what are the benefits of doing this instead of doing varies.
As the doctor says in your link, 'Prevent the need to use Global' Will ...
The use of the code is global.
global $ woocommerce; $ Customer_country = $ woocommerce- & gt; Customer- & gt; Mg ();
The code does not use the global
$ customer_country = WC () - & gt; Customer- & gt; Get_country (); // Some servers can not like this way ... the best is to use variables like foo = wc (); Then $ foo- & gt; Customer- & gt; Use get_country () ...
How to use WC ()? ...
No comments:
Post a Comment