| @@ -213,11 +213,21 @@ | ||
| 213 | 213 | * |
| 214 | 214 | * @return array |
| 215 | 215 | */ |
| 216 | 216 | public function get_localize_data() { |
| 217 | + $needs_shipping = ''; | |
| 218 | + | |
| 219 | + if ( function_exists( 'WC' ) ) { | |
| 220 | + $cart = WC()->cart; | |
| 221 | + | |
| 222 | + if ( $cart && method_exists( $cart, 'needs_shipping' ) ) { | |
| 223 | + $needs_shipping = $cart->needs_shipping(); | |
| 224 | + } | |
| 225 | + } | |
| 226 | + | |
| 217 | 227 | return [ |
| 218 | 228 | 'nonce' => wp_create_nonce( 'sellkit_elementor' ), |
| 219 | - 'wcNeedShipping' => ( function_exists( 'WC' ) ) ? WC()->cart->needs_shipping() : '', | |
| 229 | + 'wcNeedShipping' => $needs_shipping, | |
| 220 | 230 | 'url' => [ |
| 221 | 231 | 'assets' => sellkit()->plugin_url() . 'assets/', |
| 222 | 232 | ], |
| 223 | 233 | ]; |
| @@ -290,9 +300,9 @@ | ||
| 290 | 300 | |
| 291 | 301 | /** |
| 292 | 302 | * Enqueue editor scripts. |
| 293 | 303 | * |
| 294 | - * @since NEXT | |
| 304 | + * @since 1.7.4 | |
| 295 | 305 | */ |
| 296 | 306 | public function editor_enqueue_scripts() { |
| 297 | 307 | wp_localize_script( |
| 298 | 308 | 'sellkit-editor', |