Skip to content

Commit

Permalink
PLUGINS-6699
Browse files Browse the repository at this point in the history
  • Loading branch information
meteor-ec committed Nov 27, 2023
1 parent 1a4b206 commit 7309382
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions includes/class-ecwid-store-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@ public static function get_product_url( $id ) {
public static function get_product_url_from_api( $id ) {

if ( Ecwid_Api_V3::is_available() ) {

$api = new Ecwid_Api_V3();

$product = $api->get_product( $id );

if ( $product ) {

return $product->url;
}
}
Expand Down Expand Up @@ -151,12 +149,10 @@ public static function get_current_store_page_id() {

$id = get_option( self::OPTION_MAIN_STORE_PAGE_ID );
if ( $id ) {

$post = get_post( $id );
$changed = false;

while ( is_null( $post ) ) {

$changed = true;

$pages = self::get_store_pages_array();
Expand Down Expand Up @@ -261,9 +257,7 @@ public static function reset_store_page( $page_id ) {
$pages = self::_set_store_pages( $pages );

if ( $page_id == get_option( self::OPTION_MAIN_STORE_PAGE_ID ) ) {

if ( isset( $pages[0] ) ) {

$new_page = $pages[0];
// we prefer pages, not posts
foreach ( $pages as $page ) {
Expand Down Expand Up @@ -306,7 +300,6 @@ public static function get_store_pages_array() {
public static function get_store_pages_array_for_selector() {
$pages = self::get_store_pages_array();
foreach ( $pages as $ind => $page ) {

$post = get_post( $page );

if ( $page != self::get_current_store_page_id() && isset( $post ) && $post->post_type != 'page' ) {
Expand Down Expand Up @@ -494,6 +487,11 @@ public static function set_store_url() {
return;
}

$oauth = new Ecwid_OAuth();
if ( ! $oauth->has_scope( Ecwid_OAuth::SCOPE_UPDATE_STORE_PROFILE ) ) {
return;
}

$store_url = self::get_store_url();

$api = new Ecwid_Api_V3();
Expand Down

0 comments on commit 7309382

Please sign in to comment.