admin管理员组文章数量:1418611
Hope you're doing great! I am trying to print the WC()->session->get inside a shortcode but getting error , bellow is my code and error
function set_session(){
global $woocommerce;
WC()->session->set( 'some_data_get' ,' some_data_get' );
}
add_action( 'init', 'set_session' );
function show_session(){
global $woocommerce;
var_dump( WC()->session->get( 'some_data_get' ) );
}
add_shortcode( 'show_session', 'show_session' );
do_shortcode('[show_session]');
here is error
Fatal error: Uncaught Error: Call to a member function get() on null in E:\OFFICE-SERVER\htdocs\aspw\wp-content\themes\twentynineteen\functions.php:335
本文标签: Why isn39t working WooCommerce session inside shortcode
版权声明:本文标题:Why isn't working WooCommerce session inside shortcode? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745293198a2651922.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论